HERE setup
How to drive the HERE SDK through MapConductor. Initialisation takes a pair: an access key ID and a secret.
Before you start
Get the credentials
- Open the HERE Platform.
- Create a project or select an existing one.
- Create an access key for the HERE SDK.
- Copy the access key ID and the secret.
Add it with Swift Package Manager
Use File > Add Package Dependencies in Xcode and paste the package URL. The native SDK comes in as a transitive dependency — you do not add it separately.
https://github.com/MapConductor/ios-for-here
dependencies: [
.package(url: "https://github.com/MapConductor/ios-sdk-core", from: "1.1.4"),
.package(url: "https://github.com/MapConductor/ios-for-here", from: "1.0.0"),
],
targets: [
.target(
name: "YourApp",
dependencies: [
.product(name: "MapConductorCore", package: "ios-sdk-core"),
.product(name: "MapConductorForHERE", package: "ios-for-here"),
]
),
]Initialise the SDK
Call initializeHERE(accessKeyId:accessKeySecret:) exactly once, before any map view is created. It throws — do not swallow the failure.
import SwiftUI
import MapConductorForHERE
@main
struct MyApp: App {
init() {
do {
try initializeHERE(
accessKeyId: "YOUR_HERE_ACCESS_KEY_ID",
accessKeySecret: "YOUR_HERE_ACCESS_KEY_SECRET"
)
} catch {
assertionFailure("Failed to initialize HERE SDK: \(error)")
}
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}// Alternative: call it from the view's sdkInitialize closure
HereMapView(state: mapState, sdkInitialize: {
try? initializeHERE(
accessKeyId: "YOUR_HERE_ACCESS_KEY_ID",
accessKeySecret: "YOUR_HERE_ACCESS_KEY_SECRET"
)
})Add the location permission (if needed)
If you use location services with the HERE SDK, declare the purpose in Info.plist.
<key>NSLocationWhenInUseUsageDescription</key> <string>We need your location to display on the map</string>
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
You are done when the HERE map renders and zoom and pan work.
import SwiftUI
import MapConductorCore
import MapConductorForHERE
struct ContentView: View {
@StateObject var mapState = HereMapViewState(
mapDesignType: HereMapDesign.NormalDay,
cameraPosition: MapCameraPosition(
position: GeoPoint(latitude: 35.6812, longitude: 139.7671),
zoom: 12.0
)
)
var body: some View {
HereMapView(state: mapState)
.ignoresSafeArea()
}
}Map designs
HereMapDesign maps onto HERE's map schemes.
Troubleshooting
The map stays blank
- Check the access key ID and secret.
- Confirm initializeHERE runs before the map view is created.
- Catch the throw from initialisation and log what it says.
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
Markers, polylines, polygons, circles, ground images, raster layers and info bubbles all work through the shared API. HERE has no native support for polygon holes, so MapConductor renders them via generated mask tiles — your call sites stay identical to the other providers.