Skip to content

Commit

Permalink
Update documentation for declarative styling and related topics (mapb…
Browse files Browse the repository at this point in the history
  • Loading branch information
persidskiy authored Jul 31, 2024
1 parent 2566f55 commit 424c2ac
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 171 deletions.
4 changes: 0 additions & 4 deletions Sources/MapboxMaps/Documentation.docc/API Catalogs/SwiftUI.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

## Topics

### Articles
- <doc:SwiftUI-User-Guide>
- <doc:Map-Content-Gestures-User-Guide>

### SwiftUI
- ``Map-swift.struct``
- ``MapContent``
Expand Down
300 changes: 145 additions & 155 deletions Sources/MapboxMaps/Documentation.docc/Articles/Declarative Map Styling.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ Use Mapbox Maps in SwiftUI applications.

## Overview

Starting from version `11.0.0-beta.2` of MapboxMaps you can easily integrate Mapbox into your apps using the SwiftUI framework.
The Mapbox Maps SDK has a complete support of SwiftUI. This guide demonstrates how to easily integrate Mapbox Maps into your SwiftUI application.

You can find working [SwiftUI examples](https://github.com/mapbox/mapbox-maps-ios/tree/main/Apps/Examples/Examples/SwiftUI%20Examples) in the [Examples](https://github.com/mapbox/mapbox-maps-ios/tree/main/Apps/Examples) application.

- Important: SwiftUI support is experimental, the API may change in future releases.

### Feature support

The SwiftUI ``Map-swift.struct`` is built on top of the existing ``MapView``, which brings the full power of Mapbox Maps SDK to the SwiftUI applications.
Expand All @@ -18,7 +16,7 @@ However, not every single API is exposed in SwiftUI, you can track the progress

Feature | Status | Note
--- | --- | ---
Viewport | ✅
Viewport & Camera | ✅
View Annotations | ✅
Layer Annotations | ✅ | `isDraggable`, `isSelected` are not supported
Annotations Clustering | ✅ |
Expand All @@ -27,12 +25,12 @@ Puck 2D/3D | ✅
Map Events | ✅
Gesture Configuration | ✅
Ornaments Configuration | ✅
Style API | ✅
Style API | ✅ | Check out the <doc:Declarative-Map-Styling> user guide.
Custom Camera Animations | 🚧

### Getting started

To start using Mapbox Map in SwiftUI you need to import `SwiftUI` and `MapboxMaps` with `@_spi(Experimental)`. This way you can try the new APIs that have experimental support.
To start using Mapbox Map in SwiftUI you need to import `SwiftUI` and `MapboxMaps`.

```swift
import SwiftUI
Expand Down Expand Up @@ -336,4 +334,4 @@ var body: some View {
}
```

We welcome your feedback on this experimental SwiftUI support. If you have any questions or comments please open an [issue in the Mapbox Maps SDK repo](https://github.com/mapbox/mapbox-maps-ios/issues) and add the `SwiftUI` label.
We welcome your feedback on the SwiftUI support. If you have any questions or comments please open an [issue in the Mapbox Maps SDK repo](https://github.com/mapbox/mapbox-maps-ios/issues) and add the `SwiftUI` label.
11 changes: 8 additions & 3 deletions Sources/MapboxMaps/Documentation.docc/Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ The Mapbox Maps SDK for iOS is a public library for displaying interactive, thor

## Topics

### Essentials
### Articles
- <doc:Migrate-to-v11>
- <doc:SwiftUI-User-Guide>
- <doc:Declarative-Map-Styling>
- <doc:Map-Content-Gestures-User-Guide>
- <doc:Work-with-visionOS>
- <doc:SwiftUI>

### Essentials
- <doc:Map-View>
- <doc:Snapshotter-APIs>
- <doc:SwiftUI>
- <doc:Events>

### Styling
Expand All @@ -23,7 +28,7 @@ The Mapbox Maps SDK for iOS is a public library for displaying interactive, thor
- <doc:Sources>
- <doc:Layer-Property-Values>
- <doc:Expressions>
- <doc:Declarative-Map-Styling>


### Annotations
- <doc:Layer-Annotations>
Expand Down
2 changes: 0 additions & 2 deletions Sources/MapboxMaps/Style/LayerAtPosition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ extension SlotLayer {
/// Positions this layer at a specified position.
///
/// - Note: This method should be called last in a chain of layer updates.
@_spi(Experimental)
@_documentation(visibility: public)
public func position(_ position: LayerPosition) -> LayerAtPosition<Self> {
LayerAtPosition(layer: self, position: position)
}
Expand Down
1 change: 1 addition & 0 deletions Sources/MapboxMaps/SwiftUI/MapProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public struct MapProxy {
public var map: MapboxMap? { provider.mapView?.mapboxMap }

/// Extensible API for driving the map camera.
@available(*, deprecated, message: "Use Map(viewport:) initializer instead.")
public var viewport: ViewportManager? { provider.mapView?.viewport }

/// Handles location events on map.
Expand Down
1 change: 1 addition & 0 deletions scripts/doc-generation/restrict-top-sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import json

acceptedTopSectionTitles = [
"Articles",
"Essentials",
"Styling",
"Annotations",
Expand Down

0 comments on commit 424c2ac

Please sign in to comment.