Docs / Setup / iOS / ArcGIS

ArcGIS setup

How to drive the ArcGIS Maps SDK for Swift through MapConductor: pick basemaps with ArcGISDesign, and choose between a 3D and a 2D view.

PACKAGE
ios-for-arcgis
API KEY
Required
MIN iOS
17.0
VIEW
ArcGISMapView / 2D
Same provider, other platformsAndroidReact

Before you start

Xcode 15 or newer
An ArcGIS developer account
An ArcGIS API key
A deployment target of iOS 17.0 or later
STEP 01

Get an API key

  1. Open the ArcGIS Location Platform or ArcGIS Developers.
  2. Create an API key for your project.
  3. Enable the ArcGIS services you need — basemaps, geocoding, routing.
  4. Restrict the key to what your app actually does.
STEP 02

Add it with Swift Package Manager

Use File > Add Package Dependencies in Xcode and paste the package URL. The ArcGIS Maps SDK for Swift comes in automatically as a dependency.

Package URLSwift Package Manager
https://github.com/MapConductor/ios-for-arcgis
Package.swiftSwift
dependencies: [
    .package(url: "https://github.com/MapConductor/ios-sdk-core", from: "1.1.4"),
    .package(url: "https://github.com/MapConductor/ios-for-arcgis", from: "1.0.0"),
],
targets: [
    .target(
        name: "YourApp",
        dependencies: [
            .product(name: "MapConductorCore", package: "ios-sdk-core"),
            .product(name: "MapConductorForArcGIS", package: "ios-for-arcgis"),
        ]
    ),
]
STEP 03

Initialise the SDK

Call arcGISApiKeyInitialize(apiKey:) exactly once, before any map view is created.

MyApp.swiftSwift
import SwiftUI
import MapConductorForArcGIS

@main
struct MyApp: App {
    init() {
        _ = arcGISApiKeyInitialize(apiKey: "YOUR_ARCGIS_API_KEY")
    }

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}
ContentView.swiftSwift
// Alternative: call it from the view's sdkInitialize closure
ArcGISMapView(state: mapState, sdkInitialize: {
    _ = arcGISApiKeyInitialize(apiKey: "YOUR_ARCGIS_API_KEY")
})
STEP 04

Add the location permission (if needed)

If you use location, declare the purpose in Info.plist.

Info.plistXML
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need your location to display on the map</string>
LocationManager.swiftSwift
import CoreLocation

final class LocationManager: NSObject, ObservableObject, CLLocationManagerDelegate {
    private let manager = CLLocationManager()

    override init() {
        super.init()
        manager.delegate = self
    }

    func requestPermission() {
        manager.requestWhenInUseAuthorization()
    }
}

VERIFY

What you should see

Render the 3D view. Hand the same state object to ArcGISMapView2D for the 2D map. Working zoom, pan and — in 3D — tilt means you are done.

ContentView.swiftSwiftUI
import SwiftUI
import MapConductorCore
import MapConductorForArcGIS

struct ContentView: View {
    @StateObject var mapState = ArcGISMapViewState(
        mapDesignType: ArcGISDesign.Streets,
        cameraPosition: MapCameraPosition(
            position: GeoPoint(latitude: 35.6812, longitude: 139.7671),
            zoom: 12.0
        )
    )

    var body: some View {
        // 3D scene view; ArcGISMapView2D takes the very same state
        ArcGISMapView(state: mapState)
            .ignoresSafeArea()
    }
}

Map designs

ArcGISDesign maps onto Esri's basemaps; build one from a known id with ArcGISDesign.Create(id:).

ArcGISDesign
Notes
Streets
The standard street map
Imagery
Satellite imagery
Topographic
Topographic map
OsmStandard
The OpenStreetMap standard style
NavigationNight
Night navigation
DarkGray
A backdrop for your own data

Troubleshooting

The map stays blank

  • Confirm arcGISApiKeyInitialize(apiKey:) runs before the map view is created.
  • Check the key has the ArcGIS services you need enabled.
  • Check the deployment target is iOS 17.0 or later.

The build fails

  • Clean the build folder (Cmd+Shift+K).
  • Delete ~/Library/Developer/Xcode/DerivedData and rebuild.
  • Refresh the Swift Package Manager dependencies, and avoid mixing in CocoaPods.

Next

ArcGISMapView is the 3D view, ArcGISMapView2D the 2D one — and they share a state object.