From 420d71f144a6548e7b2179e89c6c52a7a0da0f3c Mon Sep 17 00:00:00 2001 From: weak Date: Tue, 15 Oct 2019 13:35:15 +0200 Subject: [PATCH] make searchTextFieldColor configurable --- LocationPicker/LocationPickerViewController.swift | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/LocationPicker/LocationPickerViewController.swift b/LocationPicker/LocationPickerViewController.swift index ac4cbdc..55e1dbd 100644 --- a/LocationPicker/LocationPickerViewController.swift +++ b/LocationPicker/LocationPickerViewController.swift @@ -44,18 +44,21 @@ open class LocationPickerViewController: UIViewController { /// default: "Select" public var selectButtonTitle = "Select" - lazy public var currentLocationButtonBackground: UIColor = { + public lazy var currentLocationButtonBackground: UIColor = { if let navigationBar = self.navigationController?.navigationBar, let barTintColor = navigationBar.barTintColor { return barTintColor } else { return .white } }() - /// default: .Minimal + /// default: .minimal public var searchBarStyle: UISearchBar.Style = .minimal - /// default: .Default + /// default: .default public var statusBarStyle: UIStatusBarStyle = .default + + @available(iOS 13.0, *) + public lazy var searchTextFieldColor: UIColor = .clear public var mapType: MKMapType = .hybrid { didSet { @@ -105,6 +108,9 @@ open class LocationPickerViewController: UIViewController { let searchBar = self.searchController.searchBar searchBar.searchBarStyle = self.searchBarStyle searchBar.placeholder = self.searchBarPlaceholder + if #available(iOS 13.0, *) { + searchBar.searchTextField.backgroundColor = searchTextFieldColor + } return searchBar }()