This file contains hidden or 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
// MARK: - DI | |
// MARK: Injected Property Wrapper | |
@propertyWrapper | |
public struct Injected<DependencyType> { | |
private var dependency : DependencyType | |
private var injector : Injector | |
public init(injector : Injector = Injector.shared) { | |
self.injector = injector |
This file contains hidden or 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
class PersistencyController { | |
enum SetupResult { | |
case success | |
case error(error: Error) | |
} | |
static let shared = PersistencyController() | |
private var persistentContainer: NSPersistentContainer! | |
var viewContext : NSManagedObjectContext { |
This file contains hidden or 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
// MARK: - Preference Key Declaration | |
struct FormValidationPreferenceKey: PreferenceKey { | |
static var defaultValue: [Bool] = [] | |
static func reduce(value: inout [Bool], nextValue: () -> [Bool]) { | |
value += nextValue() | |
} | |
} |