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
| /// Protocol definition for the FileManager | |
| protocol AppFileManager { | |
| func contents(atPath: String) | |
| } | |
| /// Protocol conformance of the system FileManager | |
| extension FileManager: AppFileManager {} | |
| /// ViewController | |
| class MyViewController: UIViewController { |
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 XCTest | |
| import Foundation | |
| /// File manager stub to override the methods we need | |
| class FileManagerStub: AppFileManager { | |
| func getContent(atPath: Stirng) -> Data? { | |
| return Data() | |
| } | |
| } |
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 XCTest | |
| import Foundation | |
| /// File manager stub to override the methods we need | |
| class FileManagerStub: FileManager { | |
| override func getContent(atPath: Stirng) -> Data? { | |
| return Data() | |
| } | |
| } |
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 | |
| protocol NotificationScheduler { | |
| func scheduleNotification(with title: String) | |
| } | |
| class NotificationManager { | |
| let notificationScheduler: NotificationScheduler | |
| init(notificationScheduler: NotificationScheduler) { |
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 | |
| protocol NotificationScheduler { | |
| func scheduleNotification(with title: String) | |
| } | |
| protocol TimeProvider { | |
| var now: Date { get } | |
| func calendar(with identifier: Calendar.Identifier) -> Calendar | |
| } |
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 XCTest | |
| class MockedNotificationScheduler: NotificationScheduler { | |
| struct Notification: Equatable { | |
| let title: String | |
| } | |
| var scheduledNotifications: [Notification] = [] | |
| func scheduleNotification(with title: 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
| import Tempura | |
| import BonMot | |
| import PinLayout | |
| struct AVM: ViewModelWithState { | |
| init(state: AppState) { | |
| } | |
| } | |
| class AView: UIView, ViewControllerModellableView { |
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
| var observers: [String: <#ObserverType#>] = [:] | |
| func add(observer: <#ObserverType#>) -> String { | |
| let uuid = UUID().uuidString | |
| self.observers[uuid] = observer | |
| return uuid | |
| } | |
| func remove(observer uuid: String) { | |
| self.observers.remove(at: uuid) |
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
| struct <#ASideEffect#>: AppSideEffect { | |
| func sideEffect(_ context: SideEffectContext<AppState, DependenciesContainer>) throws { | |
| } | |
| } | |
| struct <#AStateUpdater#>: AppStateUpdater { | |
| func updateState(_ state: inout AppState) { |
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
| static func waitForStateUpdate(context: SideEffectContext<AppState, DependenciesContainer>, | |
| attempt: Int = 50, | |
| shouldPass: @escaping (_ context: SideEffectContext<AppState, DependenciesContainer>) -> Bool) -> Promise<Void> { | |
| func recursiveWait(context: SideEffectContext<AppState, DependenciesContainer>, | |
| attempt: Int, | |
| shouldPass: @escaping (_ context: SideEffectContext<AppState, DependenciesContainer>) -> Bool, | |
| resolve: @escaping (())->(), | |
| reject: @escaping (Error)->()) { | |