Map Detail Panel¶
FUIMapDetailPanel
¶
open class FUIMapDetailPanel: UIView
A View Component that wraps the FUIMapDetailPanelSearchResultsViewController
as the searchResultsController
and the FUIMapDetailPanelContentViewController
as the content
. Switching between the two view controllers should be driven by the pushChildViewController
and popChildViewController
methods in the developer's mapView(_:didSelect:)
and mapView(_:didDeselect:)
methods.
iPhone¶
The searchResults
and content
will be presented on cards that can be swipe and panned to a bottom, middle, or top position.
iPad¶
The view is placed in the top left corner of the iPad and will dynamically resize based on the preferredContentSize
. The view is pinned to the given pinMapView
and will resize accordingly. The fitToContent
method must be called when reloading the table view.
Available¶
passThroughViews
: A[UIView]
that contains the views that are interactable when the map legend is presented on iPad. This prevents the popover from being dismissed while interacting with views in this list (ex. aMKMapView
).isApplyingBlurBackground
: ABool
that determines if the child views will have a blurred background.isSearchEnabled
: A Boolean value to instantiate search.searchResults
: AFUIMapDetailPanelSearchResultsViewController
used for the search function. Manipulate itstableView
to show search results. The developer must set thedatasource
and delegate methods.content
: AFUIMapDetailPanelContentViewController
used for showing the details. The developer must set thedatasource
and delegate methods.
Usage¶
```swift container = FUIMapDetailPanel(parentViewController: self, mapView: mapView) favoritesData = Array(sampleData[3..<sampleData.count])
container.isSearchEnabled = true container.isApplyingBlurBackground = true container.search.tableView.dataSource = searchResultsDataSource container.search.tableView.delegate = searchResultsDelegate container.search.tableView.register(FUIObjectTableViewCell.self, forCellReuseIdentifier: FUIObjectTableViewCell.reuseIdentifier) container.search.searchBar.delegate = searchResultsDelegate
container.content.headlineText = "VA Palo Alto Health Care Sys wraps to two lines..." container.content.didSelectTitleHandler = { print("Developer Select Handler Called!") } container.content.subheadlineText = "Medical Center" container.content.tableView.dataSource = contentDataSource container.content.tableView.delegate = contentDelegate container.content.tableView.register(FUIObjectTableViewCell.self, forCellReuseIdentifier: FUIObjectTableViewCell.reuseIdentifier) container.content.tableView.estimatedRowHeight = 100 #if swift(>=4.2) container.content.tableView.rowHeight = UITableView.automaticDimension #else container.content.tableView.rowHeight= UITableViewAutomaticDimension #endif
```
Manage presenting the controller on iPhone in viewDidAppear(_:)
.
swift
DispatchQueue.main.async {
self.container!.presentContainer()
}
Manage dismissing the controller on iPhone in viewWillDisappear(_:)
swift
self.presentedViewController?.dismiss(animated: false, completion: nil)
Present the detailPanel
by managing selecting and deselecting map annotations in mapView(_:didSelect:)
and mapView(_:didDeselect:)
```swift open func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
}
open func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView) {
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
}
```