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
NavigationCamera
object.Declaration
Swift
public required init(_ mapView: MapView, navigationCameraType: NavigationCameraType = .mobile)
Parameters
mapView
Instance of
MapView
, on which camera related transitions will be executed.navigationCameraType
Type 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
NavigationMapView
usesNavigationViewportDataSource
.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
NavigationMapView
usesNavigationCameraStateTransition
.Declaration
Swift
public var cameraStateTransition: CameraStateTransition
-
Call to this method executes a transition to
NavigationCameraState.following
state. When started, state will first change toNavigationCameraState.transitionToFollowing
and then to the finalNavigationCameraState.following
when ended.Declaration
Swift
public func follow(_ completion: (() -> Void)? = nil)
Parameters
completion
Completion handler, which is called whenever transition ends or doesn’t occur at all (e.g. in case if already in
NavigationCameraState.transitionToFollowing
orNavigationCameraState.following
state). -
Call to this method executes a transition to
NavigationCameraState.overview
state. When started, state will first change toNavigationCameraState.transitionToOverview
and then to the finalNavigationCameraState.overview
when ended.Declaration
Swift
public func moveToOverview(_ completion: (() -> Void)? = nil)
Parameters
completion
Completion handler, which is called whenever transition ends or doesn’t occur at all (e.g. in case if already in
NavigationCameraState.transitionToOverview
orNavigationCameraState.overview
state). -
Call to this method immediately moves
NavigationCamera
toNavigationCameraState.idle
state and stops all pending transitions.Declaration
Swift
@objc public func stop()