You will learn: how to display a web map that you created in the Create a web map design lab.

With the ArcGIS Runtime SDK for macOS, it is easy to create an app that displays a web map. A web map is special because its format is interchangeable between most applications running on the ArcGIS platform. Web maps are generally created interactively with the Map Viewer and saved in ArcGIS Online. When you save a web map it stores the initial map configuration settings such as the basemap, layer styles and the pop-up configuration, making it easy for you to load the web map and use the pre-existing settings. This will give you a jump-start building great looking apps. Web maps can also be updated and saved independently from your apps. This is handy if you want to make changes to the map and layers but don't want to make code changes to the app itself.

Before you begin

Make a copy of the finished starter app project (or download here) and open the .xcodeproj file in Xcode.


Add a web map to the map

  1. In the ViewController.swift file, we'll change the way the AGSMap is initialized to reference the web map that was created in the Configure pop-ups design lab.

     override func viewDidLoad() {
         /*** UPDATE ***/
         let itemId = "41281c51f9de45edaf1c8ed44bb10e30" // This was created in the Configure pop-ups design lab
         let map = AGSMap(url: URL(string: "https://www.arcgis.com/home/item.html?id=\(itemId)")!)
         /*** UPDATE ***/
         mapView.map = map
  2. Now press Command-R to run the app.

Congratulations, you're done!

Your app should display a map that looks like this.

Your project should look something like this.


Use your web map

Instead of using the web map we prepared, use the web map you made in the design lab Create a Web Map (2D).

In Step 1 above, replace the itemId variable with the id of your web map.

Change your map design

Open your web map in the ArcGIS Online Map Viewer, make changes to your map design, then save your map. Next time you load that map in your app your changes will be reflected.