Maps SDK for iOS
N-Ways maps in your iPhone and iPad app, in SwiftUI or UIKit, on MapLibre Native.
Version 1.0. The Swift package isn’t on a public repository yet: ask us for the source at hello@nways.ng and add it as a local package. Maps in iOS apps are free (no map-load charge). Pricing
What it is
A Swift package over MapLibre Native for iOS (6.x), for SwiftUI and UIKit. It:
- sets N-Ways’ hosted style (light or dark, English or French names);
- sends your key and your app’s bundle ID (
X-Ios-Bundle-Identifier) with every request to N-Ways, and never to anyone else, so a key restricted to your app works; - keeps the credit “© N-Ways · © OpenStreetMap contributors · Protomaps” on the map;
- has a client for geocoding, postcodes, autocomplete, address validation, places, routes, the route matrix and fares.
iOS 15 and later. import NWaysMaps also gives you MapLibre’s types.
Install
In Xcode: File → Add Package Dependencies… → Add Local… and pick the SDK’s folder; or in a Package.swift:
dependencies: [.package(path: "../sdk-native")],
targets: [.target(name: "MyApp", dependencies: [.product(name: "NWaysMaps", package: "sdk-native")])]Restrict your key to your app’s bundle ID. API keys
Show a map
import NWaysMaps
import SwiftUI
@main
struct RiderApp: App {
init() { NWaysMaps.configure(apiKey: "YOUR_API_KEY") }
var body: some Scene {
WindowGroup {
NWaysMapView(theme: .light, lang: "en") { mapView in
// Keep mapView to add annotations and layers.
}
.ignoresSafeArea()
}
}
}let map = NWaysUIMapView(frame: view.bounds, theme: .dark)
map.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(map)Everything else is MapLibre Native (MLNMapView): annotations, sources and layers, the camera, the user’s location. The style is one map load each time it’s set.
Call the APIs
NWaysMaps.client has async functions that throw NWaysError (with httpStatus, reason, message and retryAfter):
do {
let found = try await NWaysMaps.client.geocode("Allen Avenue", near: NWaysLatLng(lat: 6.6018, lng: 3.3515), limit: 5)
let trip = try await NWaysMaps.client.route(origin: .at(lat: 6.6018, lng: 3.3515),
destination: .postcode("LA08A09DB09"),
mode: .okada, fares: true)
let best = trip.routes.first // distanceM, durationS, geometry, steps, fares
} catch let e as NWaysError {
print(e.httpStatus, e.reason ?? "", e.message)
}| Function | API |
|---|---|
geocode, reverse, postcode, ghanaPost | Geocoding |
autocomplete | Autocomplete |
validateAddress | Address validation |
placesNearby, place | Places |
route, matrix, fares | Routes, Route matrix, Fares |
For the other APIs (route optimisation, static maps, fleet tracking), use the Swift client library.
CarPlay and offline
MapLibre Native draws in CarPlay templates too; use the same style URL (NWaysMaps.styleURL(theme:lang:)). For riders who lose the network, download an offline pack.
Sample app
The SDK’s source has a SwiftUI sample (Examples/ios/NWaysSample): a map of Lagos, a light and dark switch, and a search that drops a pin. Put your key in Secrets.xcconfig as NWAYS_API_KEY = … (git-ignored).
Licence
The iOS SDK (NWaysMaps) is open source under the Apache License 2.0 (Apache-2.0), Copyright 2026 N-WAYS LIMITED; its source has the LICENSE and NOTICE files. It depends on MapLibre Native for iOS (BSD 2-Clause), each under its own licence. The licence covers the code only: N-Ways maps and data stay © OpenStreetMap contributors under the Open Database Licence (ODbL), with the credit shown wherever they appear.