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
extension Reactive where Base: NSItemProvider { | |
func loadObject<T: NSItemProviderReading>(of type: T.Type) -> Single<T> { | |
Single.create { single in | |
self.base.loadObject(ofClass: type) { reading, error in | |
if let error = error { | |
single(.error(error)) | |
} else if let object = reading as? T { | |
single(.success(object)) | |
} else { |
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 ExampleConnectorFactory { | |
func buildExampleConnector(context: ExampleContext) -> ExampleConnecting | |
} | |
extension DependenciesFactory: ExampleConnectorFactory { | |
func buildExampleConnector(context: ExampleContext) -> ExampleConnecting { | |
let dependencies = ExampleConnector.Dependencies(factory: self, context: context) | |
return ExampleConnector(dependencies: dependencies) | |
} |
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 UseCase { | |
associatedtype ResultType | |
func execute() -> ResultType | |
} | |
class UseCaseContainer<T>: UseCase { | |
private let useCase: UseCaseContainer<T> | |
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 | |
import PlaygroundSupport | |
class MyViewController: UIViewController { | |
let containerView = UIView() | |
let datePicker = UIDatePicker() | |
let toolbar: UIToolbar = { | |
let toolbar = UIToolbar() |