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 for SPSmartMapView callbacks
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<SPSmartMapViewDelegate> delegate;Swift
@IBOutlet weak var delegate: (any SPSmartMapViewDelegate)? { get set } -
Delegate for user task
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<SPSmartMapUserTaskDelegate> userTaskDelegate;Swift
weak var userTaskDelegate: (any SPSmartMapUserTaskDelegate)? { get set }
-
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
latitudegps latitude
longitudegps longitude
zoomLevelthe 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
latitudegps latitude
longitudegps longitude
zoomLevelthe new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.
bearingThe new direction for the map, measured in degrees relative to true north.
pitchthe 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
latitudegps latitude
longitudegps longitude
zoomLevelthe new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.
bearingThe new direction for the map, measured in degrees relative to true north.
pitchthe pitch (tilt) of the map.
floorIndexthe floor index to show
buildingRefunique 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 -> SPMapResponseParameters
localRefidentifier for the map object. Corresponds to the ‘localRef’ property in the map data.
buildingRefunique identifier for the building
zoomLevelthe new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.
completionBlockcontaining 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 -> SPMapResponseParameters
buildingRefunique identifier for the building
completionBlockcontaining 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 -> SPMapResponseParameters
latitudegps latitude
longitudegps longitude
zoomLevelthe new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.
completionBlockcontaining 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 -> SPMapResponseParameters
latitudegps latitude
longitudegps longitude
zoomLevelthe new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.
bearingThe new direction for the map, measured in degrees relative to true north.
pitchthe pitch (tilt) of the map.
completionBlockcontaining 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 -> SPMapResponseParameters
latitudegps latitude
longitudegps longitude
zoomLevelthe new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.
bearingThe new direction for the map, measured in degrees relative to true north.
pitchthe pitch (tilt) of the map.
floorIndexthe floor index to show
buildingRefunique identifier for the building
completionBlockcontaining 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 -> SPMapResponseParameters
localRefidentifier for the point of interest. Corresponds to the ‘localRef’ property in the map data.
buildingRefunique identifier for the building
zoomLevelthe new zoom level for the map. The bigger the value, the closer the map is zoomed, 0 is the whole world map.
completionBlockcontaining 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 -> SPMapResponseParameters
buildingRefunique identifier for the building
completionBlockcontaining camera event status after completion
-
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
localRefidentifier for the point of interest. Corresponds to the ‘localRef’ property in the map data.
buildingRefunique identifier for the building
sourcewhere the map object is read from
completionBlockcontaining 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
propertiesproperties of the needed map object
completionBlockcontaining 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
identifierunique object identifier
keyfor information
valuecontaining additional information
-
Get the current camera properties of the map view
Declaration
Objective-C
- (nonnull SPSmartMapCameraOptions *)getSmartMapCameraOptions;Swift
func getSmartMapCameraOptions() -> SPSmartMapCameraOptionsReturn Value
camera options
-
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
localRefidentifier for the point of interest. Corresponds to the ‘localRef’ property in the map data.
buildingRefunique 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
mapObjectcontaining information about the object such as location, title, floor etc.
-
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
mapObjectcontaining 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
mapObjectcontaining information about the marker location, title, floor etc.
layouthow the marker title text will be aligned relative to the icon
iconNamethe name of the icon image. Make sure you’ve set the name and data with the ‘addIconImage:’ method
textColorcolor for the title text in ‘#rrggbb’ format.
textHaloColorcolor 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
mapObjectsarray 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
mapObjectsarray of map objects containing information about the marker location, title, floor etc.
layouthow the marker title text will be aligned relative to the icon
iconNamethe name of the icon image. Make sure you’ve set the name and data with the ‘addIconImage:’ method
textColorcolor for the title text in ‘#rrggbb’ format.
textHaloColorcolor 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
mapObjectto remove
-
Removes multiple custom markers from the map.
Declaration
Objective-C
- (void)removeMarkers:(nonnull NSArray<SPSmartMapObject *> *)mapObjects;Swift
func removeMarkers(_ mapObjects: [SPSmartMapObject])Parameters
mapObjectsto remove from the map
-
Removes all custom markers from the map.
Declaration
Objective-C
- (void)removeAllMarkers;Swift
func removeAllMarkers()
-
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
iconNamename to use for the icon
-
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
userTaskA 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()
-
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
SPSmartMapView Class Reference