Skip to content

Commit

Permalink
make searchTextFieldColor configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
weakfl committed Oct 15, 2019
1 parent 8911a15 commit 420d71f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions LocationPicker/LocationPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}()

Expand Down

0 comments on commit 420d71f

Please # to comment.