Beta
Maps on iPhone
Today: RanaMapsSDK 0.1.0-beta.1 is built and tested, not published yet. Ask
hello@ranamaps.com for early access.
Coverage: roads cover all of Nigeria once the Nigeria release is deployed (built, not live yet; production is Lagos only today). Lagos has the most street names, places, stops and gates.
Install
One Swift package. In Xcode choose File, Add Package Dependencies, enter Rana's package address (given with early
access), and add RanaMapsSDK to your app target. Minimum iOS 17.
SwiftUI
import SwiftUI
import RanaMapsSDK
struct TripMap: View {
let from = LatLng(lat: 6.5095, lng: 3.3711)
let to = LatLng(lat: 6.6018, lng: 3.3515)
var body: some View {
RanaMap(key: "pk_live_...", style: .day, center: LatLng(lat: 6.5244, lng: 3.3792), zoom: 12) { map in
map.addMarker(at: from, label: "A")
map.addMarker(at: to, label: "B")
map.fit([from, to])
}
.ignoresSafeArea()
// Shows "© Rana Maps © OpenStreetMap"; it cannot be switched off.
}
}
The map controller
onReady gives a RanaMapController:
| Method | What it does |
|---|---|
move(to:zoom:animated:) |
Move the camera |
center, zoom |
Read the camera |
fit(_:padding:) |
Show every point |
setStyle(.night) |
Change the style |
addMarker(at:color:label:) |
A marker; returns one with setPosition and remove |
showRoute(_:), showLine(_:) |
A route line; returns one with remove |
onTap { point in } |
Taps |
Web services
let client = try RanaClient(key: "pk_live_...")
let result = try await client.directions(origin: .point(LatLng(lat: 6.4541, lng: 3.3947)),
destination: .point(LatLng(lat: 6.5965, lng: 3.3421)), mode: .car)
// result.attribution is "© Rana Maps © OpenStreetMap".
Notes
- The key must be a public key limited to your bundle id. The SDK sends the bundle id with every request.
- Never put a secret key (
sk_) in the app. - Every failure is a
RanaErrorwith the API'scode, the HTTPstatus, therequestIdandretryAfter. - Health telemetry (never location):
RanaMaps.telemetryEnabled = false. The SDK ships its Apple privacy manifest. See telemetry and privacy.