-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: InMemoryWrapper 구현, 파일 재구화 (#537)
- Loading branch information
Showing
80 changed files
with
689 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
14th-team5-iOS/Core/Sources/BBStorage/InMemoryWrapper/InMemoryWrapper.swift
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
14th-team5-iOS/Core/Sources/BBStorages/InMemoryWrapper/InMemoryKey.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// InMemoryKey.swift | ||
// Hello | ||
// | ||
// Created by 김건우 on 6/2/24. | ||
// | ||
|
||
import Foundation | ||
|
||
extension InMemoryWrapper.Key { | ||
|
||
static let member: Self = "member" | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
164 changes: 164 additions & 0 deletions
164
14th-team5-iOS/Core/Sources/BBStorages/InMemoryWrapper/InMemorySubscript.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
// | ||
// InMemorySubscript.swift | ||
// Hello | ||
// | ||
// Created by 김건우 on 6/2/24. | ||
// | ||
|
||
import Foundation | ||
|
||
import RxSwift | ||
import RxRelay | ||
|
||
|
||
extension InMemoryWrapper { | ||
|
||
func registerInt(_ value: Int?, forKey key: Key) { | ||
register(value, forKey: key.rawValue) | ||
} | ||
|
||
func registerFloat(_ value: Float?, forKey key: Key) { | ||
register(value, forKey: key.rawValue) | ||
} | ||
|
||
func registerDouble(_ value: Double?, forKey key: Key) { | ||
register(value, forKey: key.rawValue) | ||
} | ||
|
||
func registerBool(_ value: Bool?, forKey key: Key) { | ||
register(value, forKey: key.rawValue) | ||
} | ||
|
||
func registerObject<T>(_ value: T?, forKey key: Key) where T: Encodable { | ||
register(value, forKey: key.rawValue) | ||
} | ||
|
||
func registerData(_ value: Data?, forKey key: Key) { | ||
register(value, forKey: key.rawValue) | ||
} | ||
|
||
} | ||
|
||
|
||
extension InMemoryWrapper { | ||
|
||
subscript(key: Key) -> Int? { | ||
get { integer(forKey: key.rawValue) } | ||
set { | ||
guard let value = newValue else { return } | ||
set(value, forKey: key.rawValue) | ||
} | ||
} | ||
|
||
subscript(key: Key) -> Float? { | ||
get { float(forKey: key.rawValue) } | ||
set { | ||
guard let value = newValue else { return } | ||
set(value, forKey: key.rawValue) | ||
} | ||
} | ||
|
||
subscript(key: Key) -> Double? { | ||
get { double(forKey: key.rawValue) } | ||
set { | ||
guard let value = newValue else { return } | ||
set(value, forKey: key.rawValue) | ||
} | ||
} | ||
|
||
subscript(key: Key) -> Bool? { | ||
get { bool(forKey: key.rawValue) } | ||
set { | ||
guard let value = newValue else { return } | ||
set(value, forKey: key.rawValue) | ||
} | ||
} | ||
|
||
subscript(key: Key) -> String? { | ||
get { string(forKey: key.rawValue) } | ||
set { | ||
guard let value = newValue else { return } | ||
set(value, forKey: key.rawValue) | ||
} | ||
} | ||
|
||
subscript<T>(key: Key) -> T? where T: Codable { | ||
get { object(forKey: key.rawValue, of: T.self) } | ||
set { | ||
guard let value = newValue else { return } | ||
set(value, forKey: key.rawValue) | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
extension InMemoryWrapper { | ||
|
||
subscript<T>(stream key: Key) -> Observable<T>? { | ||
return stream(forKey: key.rawValue) | ||
} | ||
|
||
subscript<T>( | ||
stream key: Key, | ||
of type: T.Type | ||
) -> Observable<T>? where T: Decodable { | ||
return stream(forKey: key.rawValue, of: type) | ||
} | ||
|
||
} | ||
|
||
|
||
extension InMemoryWrapper { | ||
|
||
func integer(forKey key: Key) -> Int? { | ||
integer(forKey: key.rawValue) | ||
} | ||
|
||
func float(forKey key: Key) -> Float? { | ||
float(forKey: key.rawValue) | ||
} | ||
|
||
func double(forKey key: Key) -> Double? { | ||
double(forKey: key.rawValue) | ||
} | ||
|
||
func bool(forKey key: Key) -> Bool? { | ||
bool(forKey: key.rawValue) | ||
} | ||
|
||
func object<T>(forKey key: Key, of type: T.Type) -> T? where T: Decodable { | ||
object(forKey: key.rawValue, of: T.self) | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
extension InMemoryWrapper { | ||
|
||
func remove(forKey key: Key) { | ||
remove(forKey: key.rawValue) | ||
} | ||
|
||
} | ||
|
||
|
||
|
||
extension InMemoryWrapper { | ||
|
||
public struct Key: Hashable, RawRepresentable, ExpressibleByStringLiteral { | ||
|
||
public var rawValue: String | ||
|
||
public init(rawValue: String) { | ||
self.rawValue = rawValue | ||
} | ||
|
||
public init(stringLiteral value: StringLiteralType) { | ||
self.rawValue = value | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.