SitumMapsLibrary
@objc
public class SitumMapsLibrary : NSObject, SitumMap
Class used to load the wayfinding module on a given view
-
Settings variable used to configure the module with all needed parameters.
Declaration
Swift
public private(set) var settings: LibrarySettings? { get }
-
Initializes the library and checks the user’s credentials.
Declaration
Swift
@available(*, deprecated, renamed: "init", message: "Please use ") @objc public convenience init(containedBy view: UIView, controlledBy viewController: UIViewController)
Parameters
view
View object that will contain the wayfinding UI
viewController
View controller associated with the containing view
-
Designated initializer
Use this to create an instance of the SitumMapsLibrary.
After that, load it into memory with the load() method.
Declaration
Swift
@objc public init(containedBy view: UIView, controlledBy viewController: UIViewController, withSettings settings: LibrarySettings)
-
try to load the module. This method can throw an exception if needed parameters are not set. See init method to know how to properly configure an instance.
Declaration
Swift
@objc public func load() throws
-
Unload Wayfinging module. This method wil clean the used resources.
If you need to load the Wayfinding module several times, make sure that you unload the previous loaded instance to guarantee the correct functioning of the WYF module.
Declaration
Swift
@objc public func unload()
-
Sets the credentials that will be used to authenticate when “load(buildingWithId:, logWith:)” is called
Declaration
Swift
@available(*, deprecated, message: "Use property on LibrarySettings instance instead") @objc public func setCredentials(_ credentials: Credentials)
-
Loads the Wayfinding UI in the assigned view and shows the selected building. If no Credentials have been set, this method will throw an exception.
Declaration
Swift
@available(*, deprecated, message: "Use load instead") @objc public func load(buildingWithId buildingId: String?) throws
Parameters
buildingId
Id of the building to be load
-
Loads the Wayfinding UI in the assigned view using the provided map and shows the selected building. If no Credentials have been set, this method will throw an exception.
Declaration
Swift
@available(*, deprecated, message: "Use load instead") @objc public func load(buildingWithId buildingId: String?, googleMapsMap gMap: GMSMapView?) throws
Parameters
buildingId
Id of the building to be load
googleMapsMap
Map to be used to present info
-
Changes the container view that currently contains the WYF UI and present it in this new view whitout the need to reset the module.
Declaration
Swift
@objc public func presentInNewView(_ view: UIView, controlledBy viewController: UIViewController)
Parameters
viewController
view controller associated with the containing view
-
Stops Situm Navigation
Declaration
Swift
@objc public func stopNavigation()
-
Stops Situm Positioning
Declaration
Swift
@objc public func stopPositioning()
-
Provides the GMSMapView instance used inside the Wayfinding view
Declaration
Swift
@available(*, deprecated, message: "Use LibrarySettings.getGoogleMap instead") public func getGoogleMap() -> GMSMapView?
Return Value
A GMSMapView instance which is the same being used by the Wayfinding controller
-
Retrieve the properties the module has been loaded with.
Declaration
Swift
@objc public func getSettings() -> LibrarySettings?
-
Allows setting a closure with a custom exit segue that will be executed when the “Go back” button is pressed. You may also include operations to be done before closing the wayfinding view. If no callback is set, the wayfinding view will try to exit using NavigationController method: popViewController(animated: Bool)
Declaration
Swift
public func setOnBackPressedCallback(_ callback: @escaping (_ sender: Any) -> Void)
Parameters
callback
Closure used to perform the exit segue from the wayfinding view
-
Sets an interceptor to read or modify the location request before is actually used to start positioning. Multiple interceptors can be add and they will be executed in the same order as they were set.
Declaration
Swift
public func addLocationRequestInterceptor(_ interceptor: @escaping (SITLocationRequest) -> Void)
Parameters
interceptor
Closure that will be executed with the location request as its parameter before starting the positioning
-
Sets an interceptor to read or modify the directions request before is actually used to start guiding Multiple interceptors can be add and they will be executed in the same order as they were set.
Declaration
Swift
public func addDirectionsRequestInterceptor(_ interceptor: @escaping (SITDirectionsRequest) -> Void)
Parameters
interceptor
Closure that will be executed with the directions request as its parameter before starting the guidance
-
Sets an interceptor to read or modify the navigation request before is actually used to obtain a route Multiple interceptors can be add and they will be executed in the same order as they were set.
Declaration
Swift
public func addNavigationRequestInterceptor(_ interceptor: @escaping (SITNavigationRequest) -> Void)
Parameters
interceptor
Closure that will be executed with the navigation request as its parameter before starting the navigation
-
Sets a delegate that get notified about changes in selection/deselection of Pois
Declaration
Swift
public func setOnPoiSelectionListener(listener: OnPoiSelectionListener?)
Parameters
delegate
OnPoiSelectedListener protocol
-
Sets a delegate that get notified about changes in the selected floor.
Declaration
Swift
public func setOnFloorChangeListener(listener: OnFloorChangeListener?)
Parameters
delegate
OnPoiSelectedListener protocol
-
Sets a delegate that get notified when the map is ready to interact with and fully loaded.
Declaration
Swift
public func setOnMapReadyListener(listener: OnMapReadyListener?)
Parameters
listener
OnMapReadyListener
-
Sets a delegate that get notified with events related to Navigation
Declaration
Swift
public func setOnNavigationListener(listener: OnNavigationListener?)
Parameters
listener
OnNavigationChangeListener
-
Sets a delegate that gets notified with events related to Custom POIS
Declaration
Swift
public func setOnCustomPoiChangeListener(listener: OnCustomPoiChangeListener?)
Parameters
listener
OnCustomPoiChangeListener
-
Start the navigation to a poi in the current building. This will:
- Start the positioning if needed
- Calculate and draw the route from the current user location to the poi.
- Provide the step-by-step instructions to reach the poi.
WARNING: this method only works during or after OnMapReadyListener.onMapReady callback is executed
- poi: navigation goes toward this SITPOI
Declaration
Swift
public func navigateToPoi(poi: SITPOI)
Parameters
poi
navigation goes toward this SITPOI
-
Select a given poi. This method will perform the proper actions over the User Interface to make that Poi the selected one WARNING: this method only works during or after OnMapReadyListener.onMapReady callback is executed
Declaration
Swift
public func selectPoi(poi: SITPOI, completion: @escaping (Result<Void, Error>) -> Void)
Parameters
poi
the SITPOI you want to select
completion
callback called when operation complete either successfully or with an error
-
Start the navigation to a given a location in the current building. The location will be determined by its floor, its latitude and its longitude. This will:
- Start the positioning if needed
- Calculate and draw the route from the current user location to the location.
- Provide the step-by-step instructions to reach the location.
WARNING: this method only works during or after OnMapReadyListener.onMapReady callback is executed
- floor: floor of the location
- lat: latitude of the location
- lng: longitude of the location
Declaration
Swift
public func navigateToLocation(floor: SITFloor, lat: Double, lng: Double)
Parameters
floor
floor of the location
lat
latitude of the location
lng
longitude of the location
-
This method centers the map on a given building and limits the map zoom and pan to that building bounds.
Declaration
Swift
public func lockCameraToBuilding(building: SITBuilding)
-
This method centers the map on a given building and limits the map zoom and pan to that building bounds.
Declaration
Swift
public func lockCameraToBuilding(buildingId: String, completion: @escaping (Result<SITBuilding, WayfindingError>) -> Void)
-
This method unlock the camera and allows the user to pan outside building bounds.
Declaration
Swift
public func unlockCamera()
-
This method filter POIs by given category Ids. This will hide the icon of every POI in the map that not matches these category Ids. If an empty array is supplied all POIs will be shown. WARNING: this method only works during or after OnMapReadyListener.onMapReady callback is executed
Declaration
Swift
public func filterPois(by categoryIds: [String])
-
Start positioning of the user in the map in loaded building
Declaration
Swift
public func startPositioning()
-
Start the custom poi creation mode
Declaration
Swift
public func startCustomPoiCreation(name: String?, description: String?, markerIcon: UIImage? = nil, markerIconSelected: UIImage? = nil)
-
Retrieve the previously stored custom poi given its id
Declaration
Swift
public func getCustomPoi(id: Int?) -> CustomPoi?
-
Retrieve the latest stored custom poi
Declaration
Swift
public func getCustomPoi() -> CustomPoi?
-
Remove the previously stored instance of custom poi
Declaration
Swift
public func removeCustomPoi(id: Int)
-
Display the stored custom poi as selected
Declaration
Swift
public func selectCustomPoi(id: Int, completion: @escaping (Result<Void, Error>) -> Void)