Skip to content

MapSearchViewController

James Barrow edited this page Jan 29, 2017 · 4 revisions

MapSearchViewController

The map search view controller is used with the search control in a map view controller. It allows searching of points plotted on the map view as well a locations.

identifier

The reuse identifier for the cell for the table view. This should be overriden when subclassing.

Declaration

Swift

public let identifier = "FrostKitMapSearchCell"

---

<br>

### mapController
The map controller related to the map search view controller.

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
public weak var mapController: MapController?


searchController

The search controller releated to the map search view controller.

Declaration

Swift

public weak var searchController: UISearchController?

---

<br>

### searchBar
A helper method to get the search controller’s search bar.

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
public var searchBar: UISearchBar?


refreshControlHolder

The refresh control for the table view controller when searching locations.

Declaration

Swift

private var refreshControlHolder = UIRefreshControl()

---

<br>

### plottedSearchResults
An array of addresses returned after searching, or nil if no results are found.

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
private var plottedSearchResults: [Address]?


locationSeatchResponse

The local search response from a locations search.

Declaration

Swift

private var locationSeatchResponse: MKLocalSearchResponse?

---

<br>

### locationSearchResults
A helper to access the results array from a local search response.

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
private var locationSearchResults: [MKMapItem]?


viewDidLoad()

Declaration

Swift

open override func viewDidLoad()


---


<br>
## Custom Getter / Setter Methods  <br>

### objectAt(_:)
The object at an index path of the selected array (plotted if segment 0 or location if segment 1).

**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
open func objectAt(_ indexPath: IndexPath) -> Any?

Parameters

`indexPath` The index path of the object.

Return Value
The object at the index path.



## Table view data source

numberOfSections(in:)

Declaration

Swift

open override func numberOfSections(in tableView: UITableView) -> Int


---

<br>

### tableView(_:numberOfRowsInSection:)


**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
open override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int


tableView(_:cellForRowAt:)

Declaration

Swift

open override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell


---

<br>

### tableView(_:didSelectRowAt:)


**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
open override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)


## UISearchBarDelegate Methods

searchBar(_:textDidChange:)

Declaration

Swift

open func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String)


---

<br>

### searchBarSearchButtonClicked(_:)


**Declaration**
> <sub>**Swift**</sub>  
> ```swift  
open func searchBarSearchButtonClicked(_ searchBar: UISearchBar)


searchBar(_:selectedScopeButtonIndexDidChange:)

Declaration

Swift

open func searchBar(_ searchBar: UISearchBar, selectedScopeButtonIndexDidChange selectedScope: Int)


---

<div class="footer" align="center"><sub>Built with <a href="https://github.com/Baza207/LittleHedgehogDocs" target="_blank">Little Hedgehog Docs</a> by <a href="mailto:james@pigonahill.com" target="_blank">James Barrow</a> - <a href="http://pigonahill.com" target="_blank">Pig on a Hill Productions</a>.</sub></div>

Clone this wiki locally