title | description | author | ms.author | ms.date | ms.topic | ms.service | services |
---|---|---|---|---|---|---|---|
Use the Azure Maps indoor maps module to develop iOS applications with Microsoft Creator services |
Learn how to use the Microsoft Azure Maps indoor maps module for the iOS SDK to render maps by embedding the module's JavaScript libraries. |
stevemunk |
v-munksteve |
12/10/2021 |
how-to |
azure-maps |
azure-maps |
The Azure Maps iOS SDK allows you to render indoor maps created in Azure Maps Creator services.
Note
The iOS SDK will support dynamic styling in a future release, coming soon!
- Be sure to complete the steps in the Quickstart: Create an iOS app. Code blocks in this article can be inserted into the
viewDidLoad
function ofViewController
. - Create a Creator resource
- Get a
tilesetId
by completing the tutorial for creating Indoor maps. You'll need to use this identifier to render indoor maps with the Azure Maps iOS SDK.
To load the indoor tilesets and map style of the tiles, you must instantiate an IndoorManager
and keep a strong reference to it.
guard let indoor = try? IndoorManager(azureMap: map, options: [.tilesetID({Your-tilesetID})]) else { return }
self.indoorManager = indoor
Important
This guide assumes that your Creator service was created in the United States. If your Creator service was created in Europe, add the following code:
self.indoorManager.setOptions([.geography(.eu)])
The Indoor Level Picker control allows you to change the level of the rendered map. You can optionally initialize an IndoorControl
and set to the appropriate option on the IndoorManager
as in the following code:
let levelControl = IndoorControl(options: [.controlPosition(.topRight)])
self.indoorManager.setOptions([.levelControl(levelControl)])
Tip
The level picker appears when you tap on a facility.
Add a delegate to the IndoorManager
to listen to indoor map events:
self.indoorManager.addDelegate(self)
IndoorManagerDelegate
has one method, which is invoked when a facility or floor changes.
func indoorManager(
_ manager: IndoorManager,
didSelectFacility selectedFacility: IndoorFacilitySelection,
previousSelection: IndoorFacilitySelection
) {
// code that you want to run after a facility or floor has been changed
print("New selected facility's ID:", selectedFacility.facilityID)
print("New selected floor:", selectedFacility.levelsOrdinal)
}
The screenshot below shows the above code displaying an indoor map.