This file contains 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
import MapKit | |
import RxSwift | |
import RxCocoa | |
extension MKLocalSearchCompleter: HasDelegate { | |
public typealias Delegate = MKLocalSearchCompleterDelegate | |
} | |
class RxMKLocalSearchCompleterDelegateProxy: | |
DelegateProxy<MKLocalSearchCompleter, MKLocalSearchCompleterDelegate>, |
This file contains 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
import MapKit | |
import RxSwift | |
import RxCocoa | |
// Taken from RxCococa until it's exposed public | |
func castOrThrow<T>(_ resultType: T.Type, _ object: Any) throws -> T { | |
guard let returnValue = object as? T else { | |
throw RxCocoaError.castingError(object: object, targetType: resultType) | |
} | |
return returnValue |
This file contains 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 searchCompleter = MKLocalSearchCompleter() | |
let textField = UITextField() | |
textField.rx.text | |
.orEmpty | |
.bind(to: searchCompleter.rx.queryFragment) | |
.disposed(by: disposeBag) | |
searchCompleter.rx.didUpdateResults | |
.subscribe(onNext: { completer in |