MapboxMaps Docs Mapbox Maps SDK for iOS Reference (v11.0.0-beta.5) (93% documented)

MapboxMaps Reference Viewport Reference
  • MapView
    • MapView
    • – SnapshotError
    • MapInitOptions
    • MapInitOptionsProvider
    • MapOptions
    • GlyphsRasterizationOptions
    • AttributionURLOpener
  • Snapshotter
    • Snapshotter
    • – SnapshotError
    • MapSnapshotOptions
    • SnapshotOverlay
    • SnapshotOverlayHandler
  • MapboxMap
    • MapboxMap
    • CameraState
    • CameraOptions
    • CameraBounds
    • CameraBoundsOptions
    • CoordinateBounds
    • RenderedQueryOptions
    • QueriedFeature
    • FeatureExtensionValue
    • MapError
    • MapLoadingError
  • Style
    • StyleURI
    • LayerPosition
    • TransitionOptions
    • Terrain
    • StyleDecodable
    • StyleEncodable
    • StyleError
    • TypeConversionError
  • Lights
    • AmbientLight
    • DirectionalLight
    • FlatLight
    • LightType
    • LightInfo
  • Sources
    • Source
    • SourceType
    • SourceInfo
    • GeoJSONSource
    • GeoJSONSourceData
    • ImageSource
    • RasterDemSource
    • RasterSource
    • VectorSource
    • PromoteId
    • Scheme
    • Encoding
  • Layers
    • Layer
    • LayerType
    • LayerInfo
    • BackgroundLayer
    • CircleLayer
    • FillExtrusionLayer
    • FillLayer
    • HeatmapLayer
    • HillshadeLayer
    • LineLayer
    • LocationIndicatorLayer
    • RasterLayer
    • SkyLayer
    • SymbolLayer
    • ModelLayer
  • Layer Property Values
    • Value
    • Anchor
    • CirclePitchAlignment
    • CirclePitchScale
    • CircleTranslateAnchor
    • FillExtrusionTranslateAnchor
    • FillTranslateAnchor
    • HillshadeIlluminationAnchor
    • IconAnchor
    • IconPitchAlignment
    • IconRotationAlignment
    • IconTextFit
    • IconTranslateAnchor
    • LineCap
    • LineJoin
    • LineTranslateAnchor
    • RasterResampling
    • ResolvedImage
    • ResolvedImageData
    • SkyType
    • ModelType
    • StyleColor
    • StyleTransition
    • SymbolPlacement
    • SymbolZOrder
    • TextAnchor
    • TextJustify
    • TextPitchAlignment
    • TextRotationAlignment
    • TextTransform
    • TextTranslateAnchor
    • TextWritingMode
    • Visibility
  • Expressions
    • Expression
    • – Element
    • – Argument
    • – Operator
    • – Option
    • Exp
    • FormatOptions
    • NumberFormatOptions
    • CollatorOptions
  • Annotations
    • AnnotationOrchestrator
    • AnnotationInteractionDelegate
    • Annotation
    • AnnotationManager
    • CircleAnnotation
    • CircleAnnotationManager
    • PointAnnotation
    • – Image
    • PointAnnotationManager
    • PolygonAnnotation
    • PolygonAnnotationManager
    • PolylineAnnotation
    • PolylineAnnotationManager
    • ClusterOptions
  • View Annotations
    • ViewAnnotationManager
    • ViewAnnotationUpdateObserver
    • ViewAnnotationOptions
    • ViewAnnotationManagerError
  • Camera Animations
    • CameraAnimationsManager
    • CameraAnimator
    • BasicCameraAnimator
    • CameraTransition
    • – Change
    • FlyToCameraAnimator
    • AnimationCompletion
    • AnimationOwner
  • Ornaments
    • OrnamentsManager
    • OrnamentOptions
    • OrnamentPosition
    • OrnamentVisibility
    • AttributionButtonOptions
    • CompassViewOptions
    • LogoViewOptions
    • ScaleBarViewOptions
  • Gestures
    • GestureManager
    • GestureOptions
    • PanMode
    • GestureManagerDelegate
    • GestureType
  • Location
    • LocationManager
    • LocationOptions
    • PuckType
    • Puck2DConfiguration
    • – Pulsing
    • Puck3DConfiguration
    • Model
    • AppleLocationProvider
    • – Options
  • Viewport
    • Viewport
    • – OverviewOptions
    • – FollowPuckOptions
    • – InsetOptions
    • ViewportOptions
    • ViewportStatus
    • ViewportStatusObserver
    • ViewportStatusChangeReason
    • ViewportState
    • FollowPuckViewportState
    • FollowPuckViewportStateOptions
    • FollowPuckViewportStateBearing
    • OverviewViewportState
    • OverviewViewportStateOptions
    • ViewportTransition
    • DefaultViewportTransition
    • DefaultViewportTransitionOptions
    • ImmediateViewportTransition
  • Offline
    • OfflineManager
    • OfflineRegionGeometryDefinition
    • OfflineSwitch
    • StylePackError
    • StylePackLoadOptions
    • TileRegionError
    • TileRegionLoadOptions
    • TilesetDescriptorOptions
    • TileStore
    • TileStoreObserver
  • GeoJSON
    • Feature
    • Geometry
  • Utilities
    • CompassDirectionFormatter
    • – Style
    • Projection
  • Other Classes
    • AnyCancelable
    • MapRecorder
    • StyleManager
    • ViewportManager
  • Other Enumerations
    • MapboxMapsOptions
    • PuckBearing
  • Other Extensions
    • AnyCancellable
    • AppKit
    • CameraChanged
    • FreeCameraOptions
    • Publisher
    • RequestInfo
    • SourceDataLoaded
  • Other Functions
    • withViewportAnimation(_:body:completion:)
  • Other Protocols
    • AppleLocationProviderDelegate
    • HeadingObserver
    • HeadingProvider
    • MapContent
    • MapViewMetricsReporter
  • Other Structures
    • Atmosphere
    • CircleAnnotationGroup
    • CustomLayer
    • ForEvery
    • Heading
    • Map
    • – Coordinator
    • MapContentBuilder
    • MapContentGestureContext
    • MapEventType
    • MapPlayerOptions
    • MapProxy
    • MapReader
    • MapRecorderOptions
    • MapStyle
    • MapViewDebugOptions
    • ModelScaleMode
    • PointAnnotationGroup
    • PolygonAnnotationGroup
    • PolylineAnnotationGroup
    • Puck2D
    • Puck3D
    • PuckRenderingData
    • Signal
    • StandardLightPreset
    • StyleImportConfiguration
    • StyleProjection
    • StyleProjectionName
    • TileCoverOptions
    • Tracing
    • ViewAnnotation
    • ViewportAnimation
  • Other Type Aliases
    • LocationUpdateAction
    • MapLayerGestureHandler
    • MapURLOpener

Viewport

  • Viewport

    The viewport represents the ways to position camera.

    The viewport may be set to the map as initial viewport:

     Map(initialViewport: .styleDefault)
    

    or as binding:

    struct UserLocationMap: View {
      @State var viewport: Viewport = .followPuck(zoom: 16, bearing: .heading)
      var body: some View {
        Map(viewport: $viewport)
      }
    }
    

    Viewport change can be animated via the withViewportAnimation(_:body:completion:).

      struct AnimatedMap: View {
          @State var viewport: Viewport = .styleDefault
          var body: some View {
              Map(viewport: $viewport)
                  .overlay {
                      Button("Locate the user") {
                          withViewportAnimation {
                              viewport = .followPuck(zoom: 16, bearing: .heading, pitch: 60)
                          }
                      }
                  }
          }
      }
    
    See more

    Declaration

    Swift

    @available(iOS 13.0, *)
    @_documentation(visibility: public)
    @_spi(Experimental)
    public struct Viewport : Equatable
  • ViewportOptions

    Configuraton options for ViewportManager.

    See more

    Declaration

    Swift

    public struct ViewportOptions : Hashable
  • ViewportStatus

    ViewportStatus contains 3 cases that express what the ViewportManager is doing at any given time.

    The state(_:) and transition(_:toState:) cases have associated values that are reference types, so equality and hash are implemented in terms of the identities of those objects.

    See more

    Declaration

    Swift

    public enum ViewportStatus : Hashable
  • ViewportStatusObserver

    ViewportStatusObserver must be implemented by objects that wish to register themselves using addStatusObserver(_:) so that they can observe status changes.

    See also

    addStatusObserver(_:) for an important note about how these notifications are delivered asynchronously.
    See more

    Declaration

    Swift

    public protocol ViewportStatusObserver : AnyObject
  • ViewportStatusChangeReason

    Constants that describe why status changed.

    See more

    Declaration

    Swift

    public struct ViewportStatusChangeReason : Hashable
  • ViewportState

    ViewportState is a protocol that ViewportManager depends on as it orchestrates transitions to and from different states.

    A ViewportState is a reference type and must not be shared among multiple ViewportManager instances simultaneously.

    The observeDataSource(with:) method allows ViewportTransitions to consume a stream of camera updates from a target state while executing a transition. startUpdatingCamera() and stopUpdatingCamera() are invoked to tell the state that it should assume or relinquish control of the map’s camera. These are typically used by ViewportManager itself after a successful transition into a state and when exiting a state, respectively.

    MapboxMaps provides implementations of ViewportState that can be created and configured via methods on ViewportManager. Applications may also define their own implementations to handle advanced use cases not covered by the provided implementations.

    States should generally pre-warm their data sources as soon as they are created to minimize delays when they become current. For this reason, only states that are currently (or soon-to-be) needed should be kept alive so that unneeded resources (e.g. location services) can be released.

    See also

    • FollowPuckViewportState
    • OverviewViewportState
    See more

    Declaration

    Swift

    public protocol ViewportState : AnyObject
  • FollowPuckViewportState

    A ViewportState implementation that tracks the location puck (to show a puck, use puckType)

    Use makeFollowPuckViewportState(options:) to create instances of this class.

    See more

    Declaration

    Swift

    public final class FollowPuckViewportState
    extension FollowPuckViewportState: ViewportState
  • FollowPuckViewportStateOptions

    Configuration options for FollowPuckViewportState.

    Each of the CameraOptions-related properties is optional, so that the state can be configured to only modify certain aspects of the camera if desired. This can be used, to achieve effects like allowing zoom gestures to work simultaneously with FollowPuckViewportState.

    See also

    transitionsToIdleUponUserInteraction
    See more

    Declaration

    Swift

    public struct FollowPuckViewportStateOptions : Codable, Hashable
  • FollowPuckViewportStateBearing

    Expresses the different ways that FollowPuckViewportState can obtain values to use when setting CameraOptions.

    See also

    puckBearing
    See more

    Declaration

    Swift

    public enum FollowPuckViewportStateBearing : Codable, Hashable
  • OverviewViewportState

    A ViewportState implementation that shows an overview of the geometry specified by its geometry.

    Use makeOverviewViewportState(options:) to create instances of this class.

    See more

    Declaration

    Swift

    public final class OverviewViewportState
    extension OverviewViewportState: ViewportState
  • OverviewViewportStateOptions

    Configuration options for OverviewViewportState.

    See more

    Declaration

    Swift

    public struct OverviewViewportStateOptions : Equatable
  • ViewportTransition

    ViewportTransition is a protocol that ViewportManager 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 ViewportManager. Applications may also define their own implementations to handle advanced use cases not covered by the provided implementations.

    See also

    • DefaultViewportTransition
    • ImmediateViewportTransition
    See more

    Declaration

    Swift

    public protocol ViewportTransition : AnyObject
  • DefaultViewportTransition

    A default ViewportTransition implementation.

    Use makeDefaultViewportTransition(options:) to create instances of this class.

    See more

    Declaration

    Swift

    public final class DefaultViewportTransition
    extension DefaultViewportTransition: ViewportTransition
  • DefaultViewportTransitionOptions

    Configuration options for DefaultViewportTransition.

    See more

    Declaration

    Swift

    public struct DefaultViewportTransitionOptions : Hashable
  • ImmediateViewportTransition

    A ViewportTransition implementation that transitions immediately without any animation.

    Use makeImmediateViewportTransition() to create instances of this class.

    Declaration

    Swift

    public final class ImmediateViewportTransition : ViewportTransition

© 2023 Mapbox. All rights reserved. (Last updated: 2023-10-09)

Generated by jazzy ♪♫ v0.14.2, a Realm project.