RxSwift での UIButton のタップ処理のイベント購読コード例
button.rx.tap
.subscribe(onNext: {[unowned self] _ in
// 何かの処理
})
.disposed(by: disposeBag)
Combine Cocoa での UIButton のタップ処理のイベント購読コード例
button.tapPublisher.sink {
// 何かの処理
}
.store(in: &cancellables)
tapPublisherが提供されてるからできる
combineだけなら
Combine のイベント購読コード例
publisher.sink {
// 何かの処理
}
.store(in: &cancellables)