Created
June 22, 2019 19:48
-
-
Save Arrlindii/5597a3161cdb13f40ed35f61f5ed68b6 to your computer and use it in GitHub Desktop.
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
| let selectedFilter = PassthroughSubject<String, Never>() | |
| let searchText = NotificationCenter.default | |
| .publisher(for: UITextField.textDidChangeNotification, object: searchTextField) | |
| .map( { ($0.object as! UITextField).text } ) | |
| .debounce(for: .milliseconds(500), scheduler: RunLoop.main) | |
| .eraseToAnyPublisher() | |
| let publisher = Publishers.CombineLatest(selectedFilter,searchText, transform: { selectedFilter, searchText in | |
| "\(selectedFilter) \(searchText)" | |
| }) | |
| _ = publisher.sink { value in | |
| print(value) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment