FUIMapLegendItem

public struct FUIMapLegendItem

FUIMapLegendItem is a struct to represent an entry in the Map Legend. A FUIMapLegendItem can be one of 4 types:

  1. icon: An item with a circular icon
  2. iconLine: An item with a circular icon and line
  3. line: An item with a line
  4. fill: An item with a filled polygon

Available:

  • title: a String that describes the FUIMapLegendItem

  • type: a FUIMapLegendItemType designated for the item.

  • backgroundColor: a UIColor displayed as a backgroundColor for the item

  • tintColor: a UIColor displayed as a tintColor for the item

  • icon: a FUIMapLegendIcon for the designated item.

  • line: a FUIMapLegendLine for the designated item.

  • fillItem: a FUIMapLegendFillItem for the designated item.

Example Initialization and Configuration:


// Type: .icon
var venueItem = FUIMapLegendItem(title: "Self Service")
venueItem.backgroundColor = UIColor.preferredFioriColor(forStyle: .map1)
let venueImage = FUIAttributedImage(image: FUIIconLibrary.map.marker.venue.withRenderingMode(.alwaysTemplate))
venueImage.tintColor = .white
venueItem.icon = FUIMapLegendIcon(glyphImage: venueImage)

var valetItem = FUIMapLegendItem(title: "Valet")
valetItem.backgroundColor = UIColor.preferredFioriColor(forStyle: .map2)
let valetImage =  FUIAttributedImage(image: FUIIconLibrary.map.marker.walk.withRenderingMode(.alwaysTemplate))
valetImage.tintColor = .white
valetItem.icon = FUIMapLegendIcon(glyphImage: valetImage)
valetItem.line = FUIMapLegendLine(dashPattern: [10,8], dashPhase: 3.0)

let highActivityRegion = FUIMapLegendFillItem()
highActivityRegion.fillColor = UIColor.preferredFioriColor(forStyle: .map3)
highActivityRegion.borderColor = UIColor.preferredFioriColor(forStyle: .map3)
var highActivityRegionItem = FUIMapLegendItem(title: "High Activity Region")
highActivityRegionItem.fillItem = highActivityRegion

var highTrafficPathItem = FUIMapLegendItem(title: "High Traffic Path")
highTrafficPathItem.backgroundColor = UIColor.preferredFioriColor(forStyle: .map4)
highTrafficPathItem.line = FUIMapLegendLine(dashPattern: [2,2], dashPhase: 0.0)

legend.items = [highActivityRegionItem, valetItem, venueItem, highTrafficPathItem]

  • A String that describes the FUIMapLegendItem

    Declaration

    Swift

    public var title: String
  • An initializer that instantiates the FUIMapLegendItem with a given title. All FUIMapLegendItem must have a title.

    Declaration

    Swift

    public init(title: String)
  • A UIColor displayed as a backgroundColor for the item. This will be the background color the marker and/or line.

    Declaration

    Swift

    public var backgroundColor: UIColor
  • A UIColor displayed as a tintColor for the item.

    Declaration

    Swift

    public var tintColor: UIColor! { get set }
  • A FUIMapLegendIcon for the designated item if it exists.

    Declaration

    Swift

    public var icon: FUIMapLegendIcon?
  • A FUIMapLegendLine for the designated item if it exists.

    Declaration

    Swift

    public var line: FUIMapLegendLine?
  • A FUIMapLegendFillItem for the designated item if it exists.

    Declaration

    Swift

    public var fillItem: FUIMapLegendFillItem?