textField delegate add realization of textField(_:shouldChangeCharactersIn:replacementString:) method in delegate wait until delegate method will be called
that by calling dispose on it. You can also add the subscription to a DisposeBag which will cancel the subscription for you automatically on deinit of the DisposeBag Instance. RxSwift Memory Management
private var emailEditablePublisher: AnyCancellable? private var passwordPublisher: AnyCancellable? private var passwordEditablePublisher: AnyCancellable? private var btnSignInEnabledPublisher: AnyCancellable?
subject.eraseToAnyPublisher() let subscriber1 = publisher.sink(receiveValue: { value in print(value) }) //subscriber1 will recive the events but not the subscriber2 subject.send("Event1") subject.send("Event2") let subscriber2 = publisher.sink(receiveValue: { value in print(value) }) //Subscriber1 and Subscriber2 will recive this event subject.send("Event3") OUTPUT: Event1 Event2 Event3 Event3
PassthroughSubject<String, Never>() let europianCities = Publishers.Merge(germanCities, italianCities) _ = europianCities.sink(receiveValue: { city in print("\(city) is a city in europe") })