Slide 12
Slide 12 text
3Y4XGJU0CTFSWBCMFˠ
import RxSwift
func issuesObservable()
-> Observable<[Issue]> {
...
}
issuesObservable()
.map { issues in
issues.filter { $0.authorId == myId }
}
.subscribe(
onNext: { myIssues in
print(myIssues)
},
onError: { error in
print(error)
},
onCompleted: {
print("completed")
}
)
import Combine
func issuesPublisher()
-> AnyPublisher<[Issue], Error> {
...
}
issuesPublisher()
.map { issues in
issues.filter { $0.authorId == myId }
}
.sink(
receiveCompletion: { completion in
switch completion {
case .finished:
print("finished")
case .failure(let error):
print(error)
}
},
receiveValue: { myIssues in
print(myIssues)
}
)
$PNCJOF1VCMJTIFS