SPSmartMapView

Objective-C

@interface SPSmartMapView

Swift

class SPSmartMapView

SPSmartMapView

This is the recommended class to use in your application when you want to display maps and user location with the Steerpath iOS SDK.

To use this class you need to have a Steerpath API access token. See SPAccountManager.h for instructions on how to authenticate.

Delegate

Camera Movement

  • Move the camera to a specific location. Does not include animation. Use ‘animateCamera’ methods if you want the camera transition to be animated.

    Declaration

    Objective-C

    - (void)setCamera:(double)latitude
            longitude:(double)longitude
            zoomLevel:(double)zoomLevel;

    Swift

    func setCamera(_ latitude: Double, longitude: Double, zoomLevel: Double)

    Parameters

    latitude

    gps latitude

    longitude

    gps longitude

    zoomLevel

    the new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.

  • Move the camera to a specific location. Does not include animation. Use ‘animateCamera’ methods if you want the camera transition to be animated.

    Declaration

    Objective-C

    - (void)setCamera:(double)latitude
            longitude:(double)longitude
            zoomLevel:(double)zoomLevel
              bearing:(double)bearing
                pitch:(double)pitch;

    Swift

    func setCamera(_ latitude: Double, longitude: Double, zoomLevel: Double, bearing: Double, pitch: Double)

    Parameters

    latitude

    gps latitude

    longitude

    gps longitude

    zoomLevel

    the new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.

    bearing

    The new direction for the map, measured in degrees relative to true north.

    pitch

    the pitch (tilt) of the map.

  • Move the camera to a specific location and change the visible floor of a building. Does not include animation. Use ‘animateCamera’ methods if you want the camera transition to be animated.

    How floor indexes work:

    Above ground level: floor > 0

    Ground level: floor == 0

    Below ground level: floor < 0

    Declaration

    Objective-C

    - (void)setCamera:(double)latitude
            longitude:(double)longitude
            zoomLevel:(double)zoomLevel
              bearing:(double)bearing
                pitch:(double)pitch
           floorIndex:(int)floorIndex
          buildingRef:(nonnull NSString *)buildingRef;

    Swift

    func setCamera(_ latitude: Double, longitude: Double, zoomLevel: Double, bearing: Double, pitch: Double, floorIndex: Int32, buildingRef: String)

    Parameters

    latitude

    gps latitude

    longitude

    gps longitude

    zoomLevel

    the new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.

    bearing

    The new direction for the map, measured in degrees relative to true north.

    pitch

    the pitch (tilt) of the map.

    floorIndex

    the floor index to show

    buildingRef

    unique identifier for the building

  • Move the camera to a specific map object in a particular building. The camera will also change its bearing to the ‘natural orientation’ of the building if one is defined in the map data. Does not include animation. Use ‘animateCamera’ methods if you want the camera transition to be animated.

    Declaration

    Objective-C

    - (void)setCameraToObject:(nonnull NSString *)localRef
                  buildingRef:(nonnull NSString *)buildingRef
                    zoomLevel:(double)zoomLevel
                   completion:(nullable void (^)(SPMapResponse))completionBlock;

    Swift

    func setCameraToObject(_ localRef: String, buildingRef: String, zoomLevel: Double) async -> SPMapResponse

    Parameters

    localRef

    identifier for the map object. Corresponds to the ‘localRef’ property in the map data.

    buildingRef

    unique identifier for the building

    zoomLevel

    the new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.

    completionBlock

    containing camera event status after completion

  • Move the camera to a specific building. Camera is zoomed in so that the whole building is visible on the map. The camera will also change its bearing to the ‘natural orientation’ of the building if one is defined in the map data. Does not include animation. Use ‘animateCamera’ methods if you want the camera transition to be animated.

    Declaration

    Objective-C

    - (void)setCameraToBuildingRef:(nonnull NSString *)buildingRef
                        completion:
                            (nullable void (^)(SPMapResponse))completionBlock;

    Swift

    func setCameraToBuildingRef(_ buildingRef: String) async -> SPMapResponse

    Parameters

    buildingRef

    unique identifier for the building

    completionBlock

    containing camera event status after completion

  • Animate the camera to a specific location.

    Declaration

    Objective-C

    - (void)animateCamera:(double)latitude
                longitude:(double)longitude
                zoomLevel:(double)zoomLevel
               completion:(nullable void (^)(SPMapResponse))completionBlock;

    Swift

    func animateCamera(_ latitude: Double, longitude: Double, zoomLevel: Double) async -> SPMapResponse

    Parameters

    latitude

    gps latitude

    longitude

    gps longitude

    zoomLevel

    the new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.

    completionBlock

    containing camera event status after completion

  • Animate the camera to a specific location.

    Declaration

    Objective-C

    - (void)animateCamera:(double)latitude
                longitude:(double)longitude
                zoomLevel:(double)zoomLevel
                  bearing:(double)bearing
                    pitch:(double)pitch
               completion:(nullable void (^)(SPMapResponse))completionBlock;

    Swift

    func animateCamera(_ latitude: Double, longitude: Double, zoomLevel: Double, bearing: Double, pitch: Double) async -> SPMapResponse

    Parameters

    latitude

    gps latitude

    longitude

    gps longitude

    zoomLevel

    the new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.

    bearing

    The new direction for the map, measured in degrees relative to true north.

    pitch

    the pitch (tilt) of the map.

    completionBlock

    containing camera event status after completion

  • Animate the camera to a specific location and change the visible floor of a building.

    How floor indexes work:

    Above ground level: floor > 0

    Ground level: floor == 0

    Below ground level: floor < 0

    Declaration

    Objective-C

    - (void)animateCamera:(double)latitude
                longitude:(double)longitude
                zoomLevel:(double)zoomLevel
                  bearing:(double)bearing
                    pitch:(double)pitch
               floorIndex:(int)floorIndex
              buildingRef:(nonnull NSString *)buildingRef
               completion:(nullable void (^)(SPMapResponse))completionBlock;

    Swift

    func animateCamera(_ latitude: Double, longitude: Double, zoomLevel: Double, bearing: Double, pitch: Double, floorIndex: Int32, buildingRef: String) async -> SPMapResponse

    Parameters

    latitude

    gps latitude

    longitude

    gps longitude

    zoomLevel

    the new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.

    bearing

    The new direction for the map, measured in degrees relative to true north.

    pitch

    the pitch (tilt) of the map.

    floorIndex

    the floor index to show

    buildingRef

    unique identifier for the building

    completionBlock

    containing camera event status after completion

  • Animate the camera to a specific map object in a particular building. The camera will also change its bearing to the ‘natural orientation’ of the building if one is defined in the map data.

    Declaration

    Objective-C

    - (void)animateCameraToObject:(nonnull NSString *)localRef
                      buildingRef:(nonnull NSString *)buildingRef
                        zoomLevel:(double)zoomLevel
                       completion:(nullable void (^)(SPMapResponse))completionBlock;

    Swift

    func animateCamera(toObject localRef: String, buildingRef: String, zoomLevel: Double) async -> SPMapResponse

    Parameters

    localRef

    identifier for the point of interest. Corresponds to the ‘localRef’ property in the map data.

    buildingRef

    unique identifier for the building

    zoomLevel

    the new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.

    completionBlock

    containing camera event status after completion

  • Animate the camera to a specific building. The camera will also change its bearing to the ‘natural orientation’ of the building if one is defined in the map data.

    Declaration

    Objective-C

    - (void)animateCameraToBuildingRef:(nonnull NSString *)buildingRef
                            completion:
                                (nullable void (^)(SPMapResponse))completionBlock;

    Swift

    func animateCamera(toBuildingRef buildingRef: String) async -> SPMapResponse

    Parameters

    buildingRef

    unique identifier for the building

    completionBlock

    containing camera event status after completion

Map Objects

  • Fetches a map object from a specific source.

    Declaration

    Objective-C

    - (void)getMapObject:(nonnull NSString *)localRef
             buildingRef:(nonnull NSString *)buildingRef
                  source:(SPObjectSource)source
              completion:(nullable void (^)(SPSmartMapObject *_Nullable,
                                            SPMapResponse))completionBlock;

    Swift

    func mapObject(_ localRef: String, buildingRef: String, source: SPObjectSource) async -> (SPSmartMapObject?, SPMapResponse)

    Parameters

    localRef

    identifier for the point of interest. Corresponds to the ‘localRef’ property in the map data.

    buildingRef

    unique identifier for the building

    source

    where the map object is read from

    completionBlock

    containing map object if successful. Also contains a response informing of any possible errors.

  • Fetches a map object from properties

    Declaration

    Objective-C

    - (void)getMapObjectByProperties:(nonnull NSDictionary *)properties
                          completion:
                              (nullable void (^)(SPSmartMapObject *_Nullable,
                                                 SPMapResponse))completionBlock;

    Swift

    func mapObject(byProperties properties: [AnyHashable : Any]) async -> (SPSmartMapObject?, SPMapResponse)

    Parameters

    properties

    properties of the needed map object

    completionBlock

    containing map object if successful. Also contains a response informing of any possible errors.

  • Set additional data for a live map object.

    Declaration

    Objective-C

    - (void)setLiveObjectInfo:(nonnull NSString *)identifier
                          key:(nonnull NSString *)key
                        value:(nonnull NSString *)value;

    Swift

    func setLiveObjectInfo(_ identifier: String, key: String, value: String)

    Parameters

    identifier

    unique object identifier

    key

    for information

    value

    containing additional information

  • Get the current camera properties of the map view

    Declaration

    Objective-C

    - (nonnull SPSmartMapCameraOptions *)getSmartMapCameraOptions;

    Swift

    func getSmartMapCameraOptions() -> SPSmartMapCameraOptions

    Return Value

    camera options

Selection

  • Centers the map on a specific object, adds marker and shows information about the object. Does nothing if a matching object can not be found in the map data.

    Declaration

    Objective-C

    - (void)selectMapObject:(nonnull NSString *)localRef
                buildingRef:(nonnull NSString *)buildingRef;

    Swift

    func selectMapObject(_ localRef: String, _ buildingRef: String)

    Parameters

    localRef

    identifier for the point of interest. Corresponds to the ‘localRef’ property in the map data.

    buildingRef

    unique identifier for the building

  • Centers the map on a specific object, adds marker and shows information about the object. Does nothing if a matching object can not be found in the map data.

    Declaration

    Objective-C

    - (void)selectMapObject:(nonnull SPSmartMapObject *)mapObject;

    Swift

    func selectMapObject(_ mapObject: SPSmartMapObject)

    Parameters

    mapObject

    containing information about the object such as location, title, floor etc.

Markers

  • Adds a custom marker onto the map. This method will display the marker with the default icon style provided by the SDK.

    Declaration

    Objective-C

    - (void)addMarker:(nonnull SPSmartMapObject *)mapObject;

    Swift

    func addMarker(_ mapObject: SPSmartMapObject)

    Parameters

    mapObject

    containing information about the marker location, title, floor etc.

  • Adds a custom marker onto the map. This method will display the marker with the layout, icon and colors that you provide as parameters. Note that before using your own icon images you must use the ‘addIconImage:’ method to provide the image data.

    Declaration

    Objective-C

    - (void)addMarker:(nonnull SPSmartMapObject *)mapObject
               layout:(SPLayout)layout
             iconName:(nonnull NSString *)iconName
            textColor:(nonnull NSString *)textColor
        textHaloColor:(nonnull NSString *)textHaloColor;

    Swift

    func addMarker(_ mapObject: SPSmartMapObject, layout: SPLayout, iconName: String, textColor: String, textHaloColor: String)

    Parameters

    mapObject

    containing information about the marker location, title, floor etc.

    layout

    how the marker title text will be aligned relative to the icon

    iconName

    the name of the icon image. Make sure you’ve set the name and data with the ‘addIconImage:’ method

    textColor

    color for the title text in ‘#rrggbb’ format.

    textHaloColor

    color for the outline of the text in ‘#rrggbb’ format.

  • Adds multiple custom markers onto the map. This method will display the markers with the default icon style provided by the SDK.

    Declaration

    Objective-C

    - (void)addMarkers:(nonnull NSArray<SPSmartMapObject *> *)mapObjects;

    Swift

    func addMarkers(_ mapObjects: [SPSmartMapObject])

    Parameters

    mapObjects

    array of map objects containing information about the markers

  • Adds multiple custom markers to the map. This method will display the markers with the layout, icon and colors that you provide as parameters. Note that before using your own icon images you must use the ‘addIconImage:’ method to provide the image data.

    Declaration

    Objective-C

    - (void)addMarkers:(nonnull NSArray<SPSmartMapObject *> *)mapObjects
                layout:(SPLayout)layout
              iconName:(nonnull NSString *)iconName
             textColor:(nonnull NSString *)textColor
         textHaloColor:(nonnull NSString *)textHaloColor;

    Swift

    func addMarkers(_ mapObjects: [SPSmartMapObject], layout: SPLayout, iconName: String, textColor: String, textHaloColor: String)

    Parameters

    mapObjects

    array of map objects containing information about the marker location, title, floor etc.

    layout

    how the marker title text will be aligned relative to the icon

    iconName

    the name of the icon image. Make sure you’ve set the name and data with the ‘addIconImage:’ method

    textColor

    color for the title text in ‘#rrggbb’ format.

    textHaloColor

    color for the outline of the text in ‘#rrggbb’ format.

  • Removes a custom marker from the map.

    Declaration

    Objective-C

    - (void)removeMarker:(nonnull SPSmartMapObject *)mapObject;

    Swift

    func removeMarker(_ mapObject: SPSmartMapObject)

    Parameters

    mapObject

    to remove

  • Removes multiple custom markers from the map.

    Declaration

    Objective-C

    - (void)removeMarkers:(nonnull NSArray<SPSmartMapObject *> *)mapObjects;

    Swift

    func removeMarkers(_ mapObjects: [SPSmartMapObject])

    Parameters

    mapObjects

    to remove from the map

  • Removes all custom markers from the map.

    Declaration

    Objective-C

    - (void)removeAllMarkers;

    Swift

    func removeAllMarkers()

Icons

  • Adds a custom image for a particular icon name. After you’ve set a custom image you can use the ‘addMarker:layout:iconName:textColor:textHaloColor’ methods to create markers with your own custom icons.

    Declaration

    Objective-C

    - (void)addIconImage:(nonnull NSString *)iconName image:(id)image;

    Swift

    func addIconImage(_ iconName: String, image: Any!)

    Parameters

    iconName

    name to use for the icon

Map mode

  • Set map mode for the map.

    Caution: Setting mapMode while map is performing a user task won’t have any effects

    Declaration

    Objective-C

    - (void)setMapMode:(SPMapMode)mapMode;

    Swift

    func setMapMode(_ mapMode: SPMapMode)

    Parameters

    mapMode

    The mode that you want the map to be in.

Navigation

  • Attemps to start a user task.

    A user task can be a navigation task for example from point A to B.

    There are quite a handful of user tasks. For now, we only have SPSmartMapNavigationUserTask which replaces all the old navigation functions.

    Declaration

    Objective-C

    - (void)startUserTask:(nonnull SPSmartMapUserTask *)userTask;

    Swift

    func start(_ userTask: SPSmartMapUserTask)

    Parameters

    userTask

    A task that need to be done by users.

  • Return the current user task that smartMap is running

    Declaration

    Objective-C

    - (nullable SPSmartMapUserTask *)getCurrentUserTask;

    Swift

    func getCurrentUserTask() -> SPSmartMapUserTask?

    Return Value

    The current user task.

  • Cancel the current user task that smartMap is running

    Declaration

    Objective-C

    - (void)cancelCurrentUserTask;

    Swift

    func cancelCurrentUserTask()

Styling

  • Get the padding for all the widgets of the map view in format [left, top, right, bottom]

    Declaration

    Objective-C

    - (nonnull NSArray<NSNumber *> *)getWidgetPadding;

    Swift

    func getWidgetPadding() -> [NSNumber]
  • Set the padding for all the widgets of the map view

    Declaration

    Objective-C

    - (void)setWidgetPadding:(CGFloat)left
                         top:(CGFloat)top
                       right:(CGFloat)right
                      bottom:(CGFloat)bottom;

    Swift

    func setWidgetPadding(left: Double, top: Double, right: Double, bottom: Double)
  • Undocumented

    Declaration

    Objective-C

    -(void)setGeoJson:(NSString*)sourceId geoJson:(nullable NSDictionary*)geoJson completion:(nullable void(^)(SPMapResponse response))completionBlock NS_SWIFT_NAME(setGeoJson(sourceId:geoJson:completion:));

    Swift

    func setGeoJson(sourceId: String, geoJson: [AnyHashable : Any]?) async -> SPMapResponse