Skip to content

MapKit Setup

This section covers the setup process for MapKit integration with MapConductor.

Use this provider when you want Apple’s built-in map SDK with no external dependencies or API keys, and are targeting Apple platforms exclusively.

  • iOS development environment (Xcode 15+)
  • iOS deployment target set to 15.0 or higher

MapKit is bundled with iOS and does not require an account or API key. MapKitMapView still supports sdkInitialize for parity with the other provider views.

Add MapConductorForMapKit to your Xcode project:

  1. In Xcode, go to File > Add Package Dependencies
  2. Enter the package URL:
    • https://github.com/MapConductor/ios-for-mapkit

If your app uses location services, add the following key to Info.plist:

<key>NSLocationWhenInUseUsageDescription</key>
<string>We need your location to display on the map</string>

Build and run your app with the following code to verify the setup:

import SwiftUI
import MapConductorCore
import MapConductorForMapKit
struct ContentView: View {
@StateObject var mapState = MapKitViewState(
mapDesignType: MapKitMapDesign.Standard,
cameraPosition: MapCameraPosition(
position: GeoPoint(latitude: 35.6812, longitude: 139.7671),
zoom: 12.0
)
)
var body: some View {
MapKitMapView(
state: mapState,
sdkInitialize: {
// Optional. Called once before MKMapView is created.
}
)
.ignoresSafeArea()
}
}

If the map displays without errors, your setup is working. Test basic interactions (zoom, pan) to confirm everything is functioning correctly.

Map not displaying

  • Verify iOS deployment target is 15.0 or higher
  • Ensure MapConductorForMapKit is correctly linked to your target

Build errors

  • Clean build folder (Cmd+Shift+K)
  • Delete derived data: ~/Library/Developer/Xcode/DerivedData
  • Rebuild project

To enable location-based features, add location permissions to Info.plist (see step 2) and request authorization in your app:

import CoreLocation
class LocationManager: NSObject, CLLocationManagerDelegate {
let manager = CLLocationManager()
override init() {
super.init()
manager.delegate = self
manager.requestWhenInUseAuthorization()
}
}

Use MapKitMapDesign static presets to set the map style:

// Standard street map
mapState.mapDesignType = MapKitMapDesign.Standard
// Satellite imagery
mapState.mapDesignType = MapKitMapDesign.Satellite
// Satellite with roads and labels
mapState.mapDesignType = MapKitMapDesign.Hybrid
// Muted standard style
mapState.mapDesignType = MapKitMapDesign.MutedStandard

Once MapKit is properly configured, you can use MapKitMapView as described in the Map View component documentation.

For more examples, see the Get Started tutorial.