Skip to content

Instantly share code, notes, and snippets.

import MapKit
import RxSwift
import RxCocoa
extension MKLocalSearchCompleter: HasDelegate {
public typealias Delegate = MKLocalSearchCompleterDelegate
}
class RxMKLocalSearchCompleterDelegateProxy:
DelegateProxy<MKLocalSearchCompleter, MKLocalSearchCompleterDelegate>,
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
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
import SwiftUI
struct FeedbackPreparationButtonStyle: ButtonStyle {
let feedbackGenerator: UIImpactFeedbackGenerator
func makeBody(configuration: Configuration) -> some View {
if configuration.isPressed { feedbackGenerator.prepare() }
return configuration.label
// Mimic the default ButtonStyle which we override with this one