ViewportTransition
public protocol ViewportTransition : AnyObject
ViewportTransition is a protocol that Viewport depends on as it orchestrates transitions
to and from different ViewportStates.
MapboxMaps provides implementations of ViewportTransition that can be created and
configured via methods on Viewport. Applications may also define their own implementations to
handle advanced use cases not covered by the provided implementations.
-
Runs the transition to
toState.The completion block must be invoked with
trueif the transition completes successfully. If the transition fails, invoke the completion block withfalse.If the returned
Cancelableis canceled, it not necessary to invoke the completion block (but is safe to do so — it will just be ignored).Transitions should handle the possibility that the “to” state might fail to provide a target camera in a timely manner or might update the target camera multiple times during the transition (a “moving target”).
Declaration
Swift
func run(to toState: ViewportState, completion: @escaping (_ success: Bool) -> Void) -> CancelableParameters
toStateThe target state for the transition.
completionA block that must be invoked when the transition is complete. Must be invoked on the main queue.
successA flag to indicate whether the transition was successful.
Return Value
a
Cancelablethat can be used to terminate the transition. Ifcancel()is invoked, the transition must immediately stop updating the camera and cancel any animations that it started.
ViewportTransition Protocol Reference