Slide 74
Slide 74 text
ඇಉظSignalProducer࡞ͬͯΈΔ
74
func fetchUsers(with name: String) -> SignalProducer<[User], APIError> {
return SignalProducer<[User], APIError> { observer, lifetime in
repository.fetchUsers(with: name) { result in
switch result {
case .success(let users):
observer.send(value: users)
observer.sendCompleted()
case .failure(let error):
observer.send(error: error)
}
}
}
}
public init(_ startHandler: @escaping (Signal.Observer, Lifetime) -> Void)
ΠχγϟϥΠβͷҾΫϩʔδϟΛ1ͭ