From 538cda3db1440f723bcf6b87cfb6a9aff44beee8 Mon Sep 17 00:00:00 2001 From: Ruoyu Fu Date: Mon, 6 May 2019 15:05:38 +0800 Subject: [PATCH] styles --- LocationInput/GMSRXExtensions.swift | 4 ++-- LocationInput/ViewController.swift | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/LocationInput/GMSRXExtensions.swift b/LocationInput/GMSRXExtensions.swift index 24e6ce1..c23f6a3 100644 --- a/LocationInput/GMSRXExtensions.swift +++ b/LocationInput/GMSRXExtensions.swift @@ -29,7 +29,7 @@ open class RxGMSDataSourceDelegateProxy register { RxGMSDataSourceDelegateProxy(dataSource: $0) } } - var placeBehaviorSubject = BehaviorSubject(value: nil) + public var placeBehaviorSubject = BehaviorSubject(value: nil) public func tableDataSource(_ tableDataSource: GMSAutocompleteTableDataSource, didAutocompleteWith place: GMSPlace) { placeBehaviorSubject.on(.next(place)) @@ -49,7 +49,7 @@ extension Reactive where Base == GMSAutocompleteTableDataSource{ return RxGMSDataSourceDelegateProxy.proxy(for: base) } - var sourceText:Binder { + public var sourceText:Binder { return Binder(self.base) { (dataSource, text: String?) in dataSource.sourceTextHasChanged(text) } diff --git a/LocationInput/ViewController.swift b/LocationInput/ViewController.swift index 18e0488..8ff50e2 100644 --- a/LocationInput/ViewController.swift +++ b/LocationInput/ViewController.swift @@ -13,14 +13,15 @@ import RxSwift class ViewController: UIViewController { - let disposeBag = DisposeBag() @IBOutlet weak var header: UIView! @IBOutlet weak var pickupResults: UITableView! @IBOutlet weak var dropoffResults: UITableView! @IBOutlet weak var pickupField: UITextField! @IBOutlet weak var dropoffField: UITextField! + let pickupSource = GMSAutocompleteTableDataSource() let dropoffSource = GMSAutocompleteTableDataSource() + let disposeBag = DisposeBag() override func viewDidLoad() { super.viewDidLoad() @@ -28,12 +29,14 @@ class ViewController: UIViewController { bindModels(textField: pickupField, table: pickupResults, source: pickupSource) bindModels(textField: dropoffField, table: dropoffResults, source: dropoffSource) } + func setupView() { header.layer.masksToBounds = false header.layer.shadowOffset = CGSize(width: 1, height: 1) header.layer.shadowRadius = 3 header.layer.shadowOpacity = 0.3 } + func bindModels(textField: UITextField, table: UITableView, source: GMSAutocompleteTableDataSource) { table.delegate = source table.dataSource = source