Skip to content

Commit 0716377

Browse files
aleksprogergithub-actions[bot]
authored andcommitted
Expose platform bindings for Indoor API and setup iOS Example (#7635)
**Content** - Generate experimental Swift(!) API for IndoorManager and make it separate from the map to allow that - Setup backbones of IndoorManager example in iOS ExampleApp to facilitate testing - Add Swift build artifact to .gitignore cc @mapbox/core-sdk cc @mapbox/maps-ios cc @mapbox/gl-native GitOrigin-RevId: 6bd7cc2fd2c5a8ecad237542967e77cb8e104207
1 parent 918601d commit 0716377

File tree

6 files changed

+65
-1
lines changed

6 files changed

+65
-1
lines changed

Examples.xcodeproj/project.pbxproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
classes = {
55
};
66
objectVersion = 63;
7+
objectVersion = 54;
8+
objectVersion = 77;
79
objects = {
810

911
/* Begin PBXBuildFile section */
@@ -36,6 +38,8 @@
3638
2997D21A7DB20098C6D03D3B /* StandardStyleImportExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 640198169EEDFC7CBEFCFCCF /* StandardStyleImportExample.swift */; };
3739
2B44F3E8EF3A50D9AE6B825F /* route.geojson in Resources */ = {isa = PBXBuildFile; fileRef = 450C8D5E4B84428FE51BCA97 /* route.geojson */; };
3840
2C03342240D5487880316518 /* AddOneMarkerSymbolExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DCBE814694CF08A9C2E4A42 /* AddOneMarkerSymbolExample.swift */; platformFilter = ios; };
41+
2C03342240D5487880316518 /* AddOneMarkerSymbolExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4DCBE814694CF08A9C2E4A42 /* AddOneMarkerSymbolExample.swift */; platformFilters = (ios, ); };
42+
2D3DF43CEE3D4C2B0B012E0E /* IndoorExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1109CA9B9EDD4DEB302501A /* IndoorExample.swift */; platformFilters = (ios, ); };
3943
2EC3AAE5D54ACFB90E98CD43 /* ElevatedLineMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09BBD2991186A6B98F730454 /* ElevatedLineMapView.swift */; };
4044
30589E5AB307FC934E466332 /* radar2.gif in Resources */ = {isa = PBXBuildFile; fileRef = D8730F8FB259A4F889609108 /* radar2.gif */; };
4145
312CE7CED726F0A572301622 /* PinView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DC3D7884D057238010CB6E4 /* PinView.swift */; };
@@ -384,6 +388,7 @@
384388
F033C8EFB89A90D6705B047D /* GeoJSONSourceExample.geojson */ = {isa = PBXFileReference; lastKnownFileType = text; path = GeoJSONSourceExample.geojson; sourceTree = "<group>"; };
385389
F0A6063E57EC170F558A3F74 /* ExampleTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleTableViewController.swift; sourceTree = "<group>"; };
386390
F0CE51977FA6E83B6F11BE5C /* Examples.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = Examples.app; sourceTree = BUILT_PRODUCTS_DIR; };
391+
F1109CA9B9EDD4DEB302501A /* IndoorExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndoorExample.swift; sourceTree = "<group>"; };
387392
F1356FEA44593D43FBC3F74B /* ColorPaletteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorPaletteView.swift; sourceTree = "<group>"; };
388393
F26EC4DB977D4C2DDBCA1924 /* MarkersExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarkersExample.swift; sourceTree = "<group>"; };
389394
F393DF039D7AD2F35C8DE4CE /* ViewExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewExtensions.swift; sourceTree = "<group>"; };
@@ -761,6 +766,7 @@
761766
50F519EC4AF0B4BEE0FDCABC /* ColorThemeMapExample.swift */,
762767
8DBF737C9C7FBF46BB5F7B78 /* CombineExample.swift */,
763768
A4EE8F38428A64B5B9D4DBBE /* CombineLocationExample.swift */,
769+
F1109CA9B9EDD4DEB302501A /* IndoorExample.swift */,
764770
60A8CD8A69D3429FCF8ACBDD /* Lights3DExample.swift */,
765771
370DFCA52EB6C7F119BF81DA /* MapEventsExample.swift */,
766772
E612275E3042D0D0AF8B583E /* MapRecorderExample.swift */,
@@ -880,6 +886,8 @@
880886
AC4B0DE570C38B503D03669A /* XCRemoteSwiftPackageReference "Fingertips" */,
881887
4F0A03F138FCA51E80A1893D /* XCLocalSwiftPackageReference "." */,
882888
);
889+
preferredProjectObjectVersion = 54;
890+
preferredProjectObjectVersion = 77;
883891
projectDirPath = "";
884892
projectRoot = "";
885893
targets = (
@@ -1051,6 +1059,7 @@
10511059
0414AD72988F405F5BA1D843 /* GlobeFlyToExample.swift in Sources */,
10521060
49F6209402BF34C06C90107A /* HeatmapLayerGlobeExample.swift in Sources */,
10531061
B9B1EE72E6203358F2785916 /* IconSizeChangeExample.swift in Sources */,
1062+
2D3DF43CEE3D4C2B0B012E0E /* IndoorExample.swift in Sources */,
10541063
423A42B555DD0B3AD4856FCF /* InsetMapExample.swift in Sources */,
10551064
94DB7E8C829041DC5F5B2300 /* InstrumentClusterCarPlaySceneDelegate.swift in Sources */,
10561065
AD0922FA7F69AEE4C23F2351 /* InteractionsPlayground.swift in Sources */,
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import UIKit
2+
@_spi(Experimental) import MapboxMaps
3+
4+
// EXPERIMENTAL: Not intended for usage in current stata. Subject to change or deletion.
5+
final class IndoorExample: UIViewController, ExampleProtocol {
6+
private var mapView: MapView!
7+
// Set indoor style. Do not commit staging style URIs.
8+
private var styleURI: String?
9+
10+
override func viewDidLoad() {
11+
super.viewDidLoad()
12+
13+
let cameraOptions = CameraOptions(
14+
center: CLLocationCoordinate2D(latitude: 40.6441, longitude: -73.7824),
15+
zoom: 16,
16+
bearing: 12,
17+
pitch: 60)
18+
let options = MapInitOptions(cameraOptions: cameraOptions)
19+
20+
mapView = MapView(frame: view.bounds, mapInitOptions: options)
21+
mapView.mapboxMap.styleURI = StyleURI(rawValue: styleURI!)!
22+
23+
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
24+
mapView.ornaments.options.scaleBar.visibility = .visible
25+
// EXPERIMENTAL: Not intended for usage in current stata. Subject to change or deletion.
26+
// mapView.mapboxMap.indoor.selectFloor(selectedFloorId: "b937e2aa3423453ab0552d9f")
27+
// mapView.mapboxMap.indoor.onIndoorUpdate { indoorState in
28+
// print(indoorState)
29+
// }
30+
31+
view.addSubview(mapView)
32+
}
33+
34+
override func viewDidAppear(_ animated: Bool) {
35+
super.viewDidAppear(animated)
36+
// The below line is used for internal testing purposes only.
37+
finish()
38+
}
39+
}

Sources/Examples/Models/Examples.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ struct Examples {
150150
Example(title: "Edit polygon with drag/drop",
151151
description: "Shows how to update a polygon with drag",
152152
type: EditPolygonExample.self)
153+
Example(title: "Display an indoor map",
154+
description: "Create and display a map that uses the indoor data and renders it.",
155+
type: IndoorExample.self)
153156
}
154157

155158
// Examples that focus on displaying the user's location.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Indoor
2+
3+
## Topics
4+
5+
### Indoor
6+
7+
- ``IndoorFloor``
8+
- ``IndoorState``
9+
- ``IndoorManager``

Sources/MapboxMaps/Documentation.docc/Documentation.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The Mapbox Maps SDK for iOS is a public library for displaying interactive, thor
4747
- <doc:Ornaments>
4848
- <doc:Gestures>
4949
- <doc:Settings-and-Constants>
50+
- <doc:Indoor>
5051

5152

5253
### Dependencies

Sources/MapboxMaps/Foundation/MapboxMap.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// swiftlint:disable file_length
22
import UIKit
3-
@_spi(Internal) @_spi(Marshalling) import MapboxCoreMaps
3+
@_spi(Internal) @_spi(Marshalling) @_spi(Experimental) import MapboxCoreMaps
44
@_implementationOnly import MapboxCommon_Private
55
import Turf
66

@@ -200,6 +200,9 @@ public final class MapboxMap: StyleManager {
200200
@_spi(Internal)
201201
public lazy var map: MapboxCoreMaps.Map = .Marshaller.toSwift(__map)
202202

203+
// @_spi(Experimental)
204+
// public lazy var indoor: IndoorManager = .Marshaller.toSwift(__map.getIndoorManager())
205+
203206
deinit {
204207
__map.destroyRenderer()
205208
}

0 commit comments

Comments
 (0)