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
#!/usr/bin/env swift | |
import Foundation | |
let script = CommandLine.arguments[1] | |
let fm = FileManager.default | |
enum Library: Hashable { | |
case core(String) |
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
@Dependency(\.loginService) var loginService |
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
final class LoginInteractorTests: XCTestCase { | |
var sut: LoginInteractor! | |
var loginService = LoginServiceMock() | |
var userService = UserServiceSpy() | |
let delegate = LoginInteractorDelegateSpy() | |
override func setUp() { | |
super.setUp() | |
DependencyContainer | |
.set(loginService, for: LoginServiceDependencyKey.self) |
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
func registerDependencies() { | |
DependencyContainer | |
.set(LoginService(), for: LoginServiceDependencyKey.self) | |
.set(UserService(), for: UserServiceDependencyKey.self) | |
} |
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
// Abstract | |
protocol NavigationController { | |
func push(_ view: View) | |
} | |
protocol View {} | |
protocol Service { | |
func fetchUser() -> User | |
func write(user: User) | |
} |
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
@propertyWrapper | |
struct EmailStyle { | |
@Lazy var wrappedValue = configure(FormTextField()) { textField in | |
textField.autocapitalizationType = .none | |
textField.autocorrectionType = .no | |
textField.placeholder = "Email" | |
textField.layer.borderWidth = 1 | |
textField.validColor = .systemGreen | |
textField.invalidColor = .systemRed | |
} |
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
public func configure<Value>(_ value: Value, _ closure: (Value) -> Void) -> Value { | |
closure(value) | |
return value | |
} |
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
@propertyWrapper | |
public enum Lazy<Value> { | |
case uninitialized(() -> Value) | |
case initialized(Value) | |
public init(wrappedValue: @autoclosure @escaping () -> Value) { | |
self = .uninitialized(wrappedValue) | |
} | |
public var wrappedValue: Value { |
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
public protocol DependencyKey { | |
associatedtype Value | |
static var currentValue: Self.Value { get set } | |
} | |
public protocol LazyDependencyKey { | |
associatedtype Value | |
static var currentValue: Self.Value? { get set } | |
} |
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
import UIKit | |
struct FormEmptyError: Error {} | |
struct FormCompleteError: Error {} | |
protocol FormProtocol { | |
var isValid: Bool { get } | |
var elements: [any FormElementProtocol] { get } | |
mutating func update() | |
} |