NavigationCamera
public class NavigationCamera : NSObject, ViewportDataSourceDelegate
NavigationCamera class provides functionality, which allows to manage camera related states
and transitions in a typical navigation scenarios. It’s fed with CameraOptions via the ViewportDataSource
protocol and executes transitions using CameraStateTransition protocol.
-
Initializer of
NavigationCameraobject.Declaration
Swift
public required init(_ mapView: MapView, navigationCameraType: NavigationCameraType = .mobile)Parameters
mapViewInstance of
MapView, on which camera related transitions will be executed.navigationCameraTypeType of camera, which is used to perform camera transition (either iOS or CarPlay).
-
Declaration
Swift
public func viewportDataSource(_ dataSource: ViewportDataSource, didUpdate cameraOptions: [String : CameraOptions])
-
Protocol, which is used to provide location related data to continuously perform camera related updates. By default
NavigationMapViewusesNavigationViewportDataSource.Declaration
Swift
public var viewportDataSource: ViewportDataSource { get set } -
Current state of
NavigationCamera. Defaults toNavigationCameraState.idle.Declaration
Swift
public private(set) var state: NavigationCameraState { get set } -
Protocol, which is used to execute camera transitions. By default
NavigationMapViewusesNavigationCameraStateTransition.Declaration
Swift
public var cameraStateTransition: CameraStateTransition -
Call to this method executes a transition to
NavigationCameraState.followingstate. When started, state will first change toNavigationCameraState.transitionToFollowingand then to the finalNavigationCameraState.followingwhen ended.Declaration
Swift
public func follow(_ completion: (() -> Void)? = nil)Parameters
completionCompletion handler, which is called whenever transition ends or doesn’t occur at all (e.g. in case if already in
NavigationCameraState.transitionToFollowingorNavigationCameraState.followingstate). -
Call to this method executes a transition to
NavigationCameraState.overviewstate. When started, state will first change toNavigationCameraState.transitionToOverviewand then to the finalNavigationCameraState.overviewwhen ended.Declaration
Swift
public func moveToOverview(_ completion: (() -> Void)? = nil)Parameters
completionCompletion handler, which is called whenever transition ends or doesn’t occur at all (e.g. in case if already in
NavigationCameraState.transitionToOvervieworNavigationCameraState.overviewstate). -
Call to this method immediately moves
NavigationCameratoNavigationCameraState.idlestate and stops all pending transitions.Declaration
Swift
@objc public func stop()
Install in Dash
NavigationCamera Class Reference