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 tableView.

## 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. a MKMapView).
  • isApplyingBlurBackground: A Bool that determines if the child views will have a blurred background.
  • isSearchEnabled: A Boolean value to instantiate search.
  • searchResults: A FUIMapDetailPanelSearchResultsViewController used for the search function. Manipulate its tableView to show search results. The developer must set the datasource and delegate methods.
  • content: A FUIMapDetailPanelContentViewController used for showing the details. The developer must set the datasource and delegate methods.

## Usage

 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(_:).

 DispatchQueue.main.async {
    self.container!.presentContainer()
 }

Manage dismissing the controller on iPhone in viewWillDisappear(_:)

 self.presentedViewController?.dismiss(animated: false, completion: nil)

Present the detailPanel by managing selecting and deselecting map annotations in mapView(_:didSelect:) and mapView(_:didDeselect:)

 open func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {

     let selectedAnnotation = view.annotation

     if selectedAnnotation is MKUserLocation {
        return
     }

    self.devUpdateDetailVC(annotation: selectedAnnotation!)

     DispatchQueue.main.async {
         container.pushChildViewController()
     }


     for annotation in mapView.annotations {
        if let annotation = annotation as? MKAnnotation, !annotation.isEqual(selectedAnnotation) {
            self.container.content.tableView.dataSource = newDataSource
            self.container.fitToContent()
            DispatchQueue.main.async {
                self.container.pushChildViewController()
            }
            return
        }
    }
 }

 open func mapView(_ mapView: MKMapView, didDeselect view: MKAnnotationView) {

     let selectedAnnotation = view.annotation

     if selectedAnnotation is MKUserLocation {
        return
     }

     DispatchQueue.main.async {

         if self.mapView.selectedAnnotations.isEmpty {
            self.container.popChildViewController()
         } else {
            self.container.content.tableView.dataSource = newDataSource
            self.container.fitToContent()
            self.container.content.tableView.reloadData()
         }
     }
 }

  • An initializer to create a FUIMapDetailPanel. It takes in a parentViewController to properly present the child view controller dependent on its platform.

    Declaration

    Swift

    public init(parentViewController parent: UIViewController, mapView pinnedView: UIView? = nil)

    Parameters

    parent

    A UIViewController that instantiated the FUIMapDetailPanel

    mapView

    An optional view reference, which will be used for pinning constraints for the detail panel container’s managed views. If nil, the parentViewController.view property is used.

  • A method to present the container onto the parent view controller. This method must be explicitly called in viewDidAppear(_:) to show the container on iPhone.

    Declaration

    Swift

    public func presentContainer()
  • A method to resize the container that must be called when a childViewController is reloaded. A correct preferredContentSize is required to get the correct resizing.

    Declaration

    Swift

    public func fitToContent()
  • A method to present the contentViewContrller as a detail view within the device specific container.

    Note

    Implementing the correct preferredContentSize will allow for correct dynamic resizing. If a child view controller gets updated or reloaded, it is required to call the fitToContent method.

    Declaration

    Swift

    public func pushChildViewController(completion: (() -> Void)? = nil)

    Parameters

    completion

    An optional closure function used by developer to define post processing behavior after content is pushed to detail panel.

  • A method to pop the presented ChildView Controller.

    Declaration

    Swift

    public func popChildViewController(completion: (() -> Void)? = nil)

    Parameters

    completion

    An optional closure function used by developer to define post processing behavior after content is popped from detail panel.

  • The FUIMapDetailPanel.ActionTableViewCell is a UITableViewCell consisting of a UILabel and a UIImageView. This cell is intended to be used as a call to action in the map detail panel.

    Available:

    • actionTitleLabel: A UILabel describing the intended action.
    • actionImageView: A UIImageView that will have an icon image and a tint color.

    Initialization and Configuration:

    Register the cell within the viewDidLoad method

    self.tableView.register(FFUIMapDetailPanel.ActionTableViewCell.self, forCellReuseIdentifier: FUIMapDetailPanel.ActionTableViewCell.reuseIdentifier)
    

    Within the tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath):

    let cell = tableView.dequeueReusableCell(withIdentifier: FUIMapDetailPanel.ActionTableViewCell.reuseIdentifier, for: indexPath) as! FUIMapDetailPanel.ActionTableViewCell
    cell.actionTitleLabel.text = "Add Notification"
    cell.actionImageView.image = FUIIconLibrary.system.create.withRenderingMode(.alwaysTemplate)
    return cell
    

    theming:

    fdlFUIMapDetailActionTableViewCell_actionTitleLabel {
    font-style: body;
    font-color: @tintColorDark;
    }
    
    fdlFUIMapDetailActionTableViewCell_actionImageView {
    tint-color: @primary5;
    }
    
    See more

    Declaration

    Swift

    @IBDesignable
    open class ActionTableViewCell : FUIBaseTableViewCell, FUIBackgroundSchemeSupporting
  • The FUIMapDetailButtonTableViewCell is a UITableViewCell consisting of a FUIButton and a FUILabel within a vertical UIStackView.

    Available:

    • button: An FUIButton with access to custom headline text and subheadline text.
    • buttonHeadlineText: A String to describe the main function of the button
    • buttonSubheadlineText: A String to add additional details to the buttonHeadlineText
    • descriptionLabel: An FUILabel used as a description beneath the button. The label can wrap up to 2 lines.

    Initialization and Configuration:

    Register the cell within the viewDidLoad method

    self.tableView.register(FUIMapDetailButtonTableViewCell.self, forCellReuseIdentifier: FUIMapDetailButtonTableViewCell.reuseIdentifier)
    

    Within the tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath):

    let cell = tableView.dequeueReusableCell(withIdentifier: FUIMapDetailButtonTableViewCell.reuseIdentifier, for: indexPath) as! FUIMapDetailButtonTableViewCell
    cell.button.titleLabel?.numberOfLines = 0
    cell.buttonHeadlineText = "Directions"
    cell.buttonSubheadlineText = "22 minute drive"
    cell.button.backgroundColor = UIColor.preferredFioriColor(forStyle: .tintColor)
    cell.descriptionLabel.text = "ABC Drive, Cupertino, CA"
    return cell
    

    theming

    fdlFUIMapDetailButtonTableViewCell_button {
    font-name: semiboldSystem;
    font-size: 13;
    font-color: @primary1;
    background-color-normal: @tintColorDark;
    background-color-highlighted: @tintColorTapStateDark;
    }
    
    fdlFUIMapDetailButtonTableViewCell_descriptionLabel {
    font-style: footnote;
    font-color: @primary1;
    }
    
    See more

    Declaration

    Swift

    open class ButtonTableViewCell : UITableViewCell
  • UITableViewCell subclass used for displaying business object status in Map Floorplan Detail Panel.

    Supports optional image & text. Images are left aligned and placed to the left of the text. Images are expected to be 16px by 16px.

    Usage

    let cell = tableView.dequeueReusableCell(withIdentifier: FUIMapDetailPanel.StatusTableViewCell.reuseIdentifier, for: indexPath) as! FUIMapDetailPanel.StatusTableViewCell cell.statusImage = FUIIconLibrary.indicator.veryHighPriority cell.status.text = High

    Theming

    nuiClass:

    fdlFUIMapDetailPanel.StatusTableViewCell {}
    fdlFUIMapDetailStatusTableViewCell {} // deprecated
    

    Supported TEXT class paths:

    fdlFUIMapDetailPanel.StatusTableViewCell_status {}
    fdlFUIMapDetailStatusTableViewCell_status {} // deprecated
    

    Supported TEXT properties:

    font-color: Color;
    font-style: UIFontTextStyle;
    text-line-clamp: Integer;
    text-align: NSTextAlignment;
    

    Supported IMAGE class paths:

    fdlFUIMapDetailPanel.StatusTableViewCell_statusImage {}
    fdlFUIMapDetailStatusTableViewCell_statusImage {} // deprecated
    

    Supported IMAGE properties:

    tint-color: Color;
    
    See more

    Declaration

    Swift

    @IBDesignable
    open class StatusTableViewCell : FUIBaseDrawingTableViewCell<FUIMapDetailStatusView>