LocationPicker
LocationPicker copied to clipboard
Added optional param to immediately dismiss after selecting location from SearchResultVC and an optional close navBar button item.
There were two things needed for my project: -
- Immediately dismiss after user tap a location from SearchResults TableView.
- Show a close button on navBar so that user can simply dismiss the Location picker if they change their mind. This button is very useful if the location picker was presented modally as there is no a back button generated like when the VC is pushed from navigation stack.
So I have implemented the two features leaving the old implementation unchanged. If someone in the future needs these two things they simply have to change the following boolean flags to true before pushing or presenting the location picker.
public var dismissImmediatelyAfterTableViewSelection = false
public var showCloseButtonOnNavBar = false
eg:
let locationPicker = LocationPickerViewController()
locationPicker.dismissImmediatelyAfterTableViewSelection = true
locationPicker.showCloseButtonOnNavBar = true
There is one more thing too. As a bonus, I have added another sample app named ProgramaticDemo, which demo the library for pure code based UIs.
Below is a screenshot showing the new added close button on top right corner (Useful for modally presented picker).