Blog Post

Azure Maps Blog
3 MIN READ

Announcing public preview of Azure Maps iOS SDK

cschotte's avatar
cschotte
Icon for Microsoft rankMicrosoft
Oct 13, 2021

From startups to large organizations, our customers in every industry use mapping and location-aware technology in their mobile solutions and Line-of-Business applications. It can be for mobile workforces, tracking assets (IoT), or as simple as helping a customer find your business (Store locator).

Azure Maps already has support for the Web and Android, but as of today, we are excited to announce the public preview of Azure Maps iOS SDK! With the Azure Maps iOS SDK, we make it easier for developers to integrate immersive mapping solutions in their mobile applications for the Apple ecosystem with the power of the Microsoft Cloud.

 

The Azure Maps iOS SDK has functional parity of the feature set in the Azure Maps Web SDK and Azure Maps Android SDK for easy cross-platform adoption. Like the Android SDK, our iOS SDK leverages the data-driven style expressions and supports vector tiles to provide the best user experience for customers' business logic and boost the performance of rendering massive data set.

Ease of development and maintenance

When working on a cross-platform solution, it is essential to reuse your Azure Maps knowledge across these different platforms without losing time in relearning. The Azure Maps team is proud to create a consistent developer experience across our Web, Android, and iOS offerings. Developers can easily add rich and performant map visualizations and geospatial experiences to their solutions across different platforms with the benefit of consistent code and low maintenance.

 

For example, the code below demonstrates adding a heat map layer to an Azure Map in Web, Android, and iOS projects. As a result, developers now can use almost identical code to develop mapping solutions and offer a consistent experience across these platforms.

 

 

Getting started

How to add Azure Maps to an iOS app you can read in the following steps:

 

Prerequisites

  1. Sign into the Azure portal. If you don't have an Azure subscription, create a free account before you begin.
  2. Make an Azure Maps account.
  3. Obtain a primary subscription key, also known as the primary key or the subscription key. For more information on authentication in Azure Maps, see manage authentication in Azure Maps.
  4. Download ‎Xcode on the Mac App Store for free.
  5. The Azure Maps iOS SDK is distributed via the Swift Package Manager for this public preview.

Create a project in Xcode
First, create a new iOS App project. Complete these steps to create an Xcode project:

  1. Under File, select New -> Project.
  2. On the iOS tab, select App, and then choose Next.
  3. Enter app name, bundle id, and select Next.

See the Creating an Xcode Project for an App for more help with creating a new project.

 

Install the Azure Maps iOS SDK

The next step in building your application is to install the Azure Maps iOS SDK. Complete these steps to install the Azure Maps Control:

  1. Under Project setting’s Package Dependencies, click on + button to add package dependency.
  2. Inside the appeared dialog, in the search bar in the top right corner, insert https://github.com/Azure/azure-maps-ios-sdk-distribution.git, in Dependency rule version field, fill 1.0.0-pre.2 (We recommended to use Up to Next Major Version in the Dependency Rule)
  3. Wait until package gets resolved alongside its dependencies. Click on Add Package to complete the dependency setup.

 

 

 

Add the Map Control to the View

Now that we have the Azure Maps Control installed, we can use the Map Control in our project.

  1. Add custom UIView to the view controller.
  2. Select MapControl class from AzureMapsControl module
  3. In the AppDelegate.swift file you'll need to:
    1. add import for the Azure Maps SDK
    2. set your Azure Maps authentication information: Setting the authentication information on the AzureMaps class globally using the AzureMaps.configure(subscriptionKey:) or AzureMaps.configure(aadClient:aadAppId:aadTenant:) methods makes it so you won't have to add your authentication information on every view.
  4. Select the run button, or press CMD + R, to build your application. Xcode will take a few seconds to build the application. After the build is complete, you can test your application on the simulated iOS device.

 

Feedback

Visit the Azure Maps portal today to get started, and as always, we look forward to your feedback on our Tech Community site.

Updated Oct 22, 2021
Version 3.0
  • mickane4's avatar
    mickane4
    Copper Contributor

    Can you provide an example of the minimum AppDelegate.swift code required to run the example map shown above?