wemapsdk
public class wemapsdk: UIView, WKUIDelegate
Inheritance
UIView
, WKNavigationDelegate
, WKScriptMessageHandler
, WKUIDelegate
Initializers
init?(coder:)
public required init?(coder aDecoder: NSCoder)
Properties
sharedInstance
public static let sharedInstance
currentUrl
public var currentUrl: String = ""
delegate
weak open var delegate: wemapsdkViewDelegate?
Methods
observeValue(forKeyPath:of:change:context:)
public override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?)
layoutSubviews()
public override func layoutSubviews()
webView(_:didFinish:)
open func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!)
webView(_:didCommit:)
public func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!)
webView(_:didFail:withError:)
open func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error)
webView(_:requestMediaCapturePermissionFor:initiatedByFrame:type:decisionHandler:)
@available(iOS 15.0, *)
public func webView(_ webView: WKWebView, requestMediaCapturePermissionFor origin: WKSecurityOrigin, initiatedByFrame frame: WKFrameInfo, type: WKMediaCaptureType, decisionHandler: @escaping (WKPermissionDecision) -> Void)
webView(_:requestDeviceOrientationAndMotionPermissionFor:initiatedByFrame:decisionHandler:)
@available(iOS 15.0, *)
public func webView(_ webView: WKWebView, requestDeviceOrientationAndMotionPermissionFor origin: WKSecurityOrigin, initiatedByFrame frame: WKFrameInfo, decisionHandler: @escaping (WKPermissionDecision) -> Void)
configure(config:)
public func configure(config: wemapsdk_config) -> wemapsdk
presentIn(view:)
public func presentIn(view: UIView) -> wemapsdk
loadMapUrl()
public func loadMapUrl()
userContentController(_:didReceive:)
public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage)
waitForReady()
public func waitForReady()
openEvent(WemapEventId:)
Open an event on the map. This can only be used for maps which use events.
public func openEvent(WemapEventId id:Int)
Parameters
- id: event id
closeEvent()
Close the current opened event. Go to the search view.
public func closeEvent()
setZoom(zoom:)
public func setZoom(zoom zoom: Double)
openPinpoint(WemapPinpointId:)
Open a pinpoint on the map.
public func openPinpoint(WemapPinpointId id:Int)
Parameters
- id: id of the pinpoint to open
closePinpoint()
Close the current opened pinpoint. Go to the search view.
public func closePinpoint()
setPinpoints(WemapPinpoints:)
Populates the map with given pinpoints.
public func setPinpoints(WemapPinpoints pinpoints: [WemapPinpoint])
Parameters
- pinpoints: pinpoints to populate the map.
setFilters(WemapFilters:)
Update search filters (dates, tags, text).
public func setFilters(WemapFilters: WemapFilters)
Parameters
- WemapFilters: Filters to set. See WemapFilters.
setIndoorFeatureState(id:state:)
public func setIndoorFeatureState(id: Int, state: [String: Any])
navigateToPinpoint(WemapPinpointId:location:heading:)
Start navigation to a pinpoint. The navigation will start with the user location.
public func navigateToPinpoint(WemapPinpointId id:Int,
location: WemapLocation? = nil,
heading: Int? = nil)
Parameters
- id: Id of the destination pinpoint.
- location: For relative navigation only. Navigation start location. See WemapLocation.
- heading: For relative navigation only. Navigation start heading (in degrees).
stopNavigation()
Stop the currently running navigation.
public func stopNavigation()
signInByToken(accessToken:)
Sign in to the UFE with a Wemap token.
public func signInByToken(accessToken: String)
enableSidebar()
Activate the bar with several rows of content (of events, pinpoints, list, etc).
public func enableSidebar()
disableSidebar()
Deactivate the bar with several rows of content (of events, pinpoints, list, etc).
public func disableSidebar()
signOut()
Sign out the current user.
public func signOut()
setSourceLists(sourceLists:)
Define one or more lists to be displayed on the map in addition of the current pinpoints of the map.
public func setSourceLists(sourceLists: Array<Int>)
Parameters
- sourceLists: list of sources
aroundMe()
Center the map on the user's location.
public func aroundMe()
disableAnalytics()
Disable analytics tracking
public func disableAnalytics()
enableAnalytics()
Enable analytics tracking
public func enableAnalytics()
drawPolyline(coordinatesList:options:completion:)
Draw a polyline on the map between multiple coordinates. You can either draw a raw array of coordinates or use our itinerary service to draw a route between multiple points.
@available(iOS 14.0, *)
public func drawPolyline(coordinatesList: [Coordinates], options: PolylineOptions? = nil, completion: ((String)->())? = nil)
Parameters
- coordinatesList: id of lists to be added to the map.
- options: the polyline options. Please refer to the JS documentation to check its default values.
- completion: the completion handler which return the id of the created polyline.
removePolyline(id:)
Remove a polyline from the map.
public func removePolyline(id: String)
Parameters
- id: id of polyline.
setCenter(center:)
Center the map on the given position.
public func setCenter(center: Coordinates)
Parameters
- center: the new center.
centerTo(center:zoom:)
Center the map on the given position and set the zoom level.
public func centerTo(center: Coordinates, zoom: Double)
Parameters
- center: the new center.
- zoom: the new zoom level.
easeTo(center:zoom:padding:bearing:pitch:duration:animate:)
public func easeTo(center: Coordinates, zoom: Double?,
padding: [String: Double]? = nil,
bearing: Double? = nil,
pitch: Double? = nil,
duration: Double? = nil,
animate: Bool? = nil)
fitBounds(bounds:options:)
Fit map on given bounds and padding.
public func fitBounds(bounds: BoundingBox, options: [String: [String: Double]])
Parameters
- bounds: [W,S,E,N] bounds.
- options: {"padding": {"top": 0, "right": 0, "bottom": 0, "left": 0}}
disablePositioningSystem()
Disable the inner positioning system You can still use setUserLocation to set the user location and use your own positioning system.
public func disablePositioningSystem()
disablePositioningSystem(completionHandler:)
Disable the inner positioning system You can still use setUserLocation to set the user location and use your own positioning system.
@available(iOS 14.0, *)
public func disablePositioningSystem(completionHandler: (()->())? = nil)
Parameters
- completionHandler: A handler block to execute if no exception is raised.
getUserLocation(completionHandler:)
Get the user location.
@available(iOS 14.0, *)
public func getUserLocation(completionHandler: ((Coordinates)->())? = nil)
Parameters
- completionHandler: A handler block to execute if the user accepts to share his location.
getZoom(completionHandler:)
Get the current zoom level.
@available(iOS 14.0, *)
public func getZoom(completionHandler: ((Double)->())? = nil)
Parameters
- completionHandler: A handler block to execute if the zoom level provided.
setUserLocation(userLocation:)
A marker will be added to show the user’s location on the map. If the map features multiple floors, the marker will only be visible on the corresponding floor.
public func setUserLocation(userLocation: Coordinates)
Parameters
- userLocation: The user location.
setUserLocation(userLocation:completionHandler:)
A marker will be added to show the user’s location on the map. If the map features multiple floors, the marker will only be visible on the corresponding floor.
@available(iOS 14.0, *)
public func setUserLocation(userLocation: Coordinates, completionHandler: (()->())? = nil)
Parameters
- userLocation: The user location.
- completionHandler: A handler block to execute if no exception is raised.
getDeviceAttitude(completionHandler:)
Get the device attitude.
@available(iOS 14.0, *)
public func getDeviceAttitude(completionHandler: ((Attitude)->())? = nil)
Parameters
- completionHandler: A handler block to execute with the device attitude as first parameter if no exception is raised.
setDeviceAttitude(attitude:)
Set the user attitude.
public func setDeviceAttitude(attitude: Attitude)
Parameters
- attitude: The device attitude.
setDeviceAttitude(attitude:completionHandler:)
Set the user attitude.
@available(iOS 14.0, *)
public func setDeviceAttitude(attitude: Attitude, completionHandler: (()->())? = nil)
Parameters
- attitude: The device attitude.
- completionHandler: A handler block to execute with the device attitude as first parameter if no exception is raised.
addMarker(marker:completion:)
Add a marker to the map.
@available(iOS 14.0, *)
public func addMarker(marker: Marker, completion: ((String)->())? = nil)
Parameters
- marker: marker to add on the map.
- completion: the completion handler which return the id of the created marker.
removeMarker(id:)
Remove a marker to the map.
public func removeMarker(id: String)
Parameters
- id: the marker id to remove.
forceARViewMode(mode:)
Force the AR mode to 'ON', 'OFF' or default 'AUTO'
public func forceARViewMode(mode: ARViewMode)
Parameters
- mode: AR mode