Session configuration
GraffityARCloudConfiguration is immutable and Sendable. Construct it once, then pass it to try GraffityARCloud(configuration:) on the main actor. All public SDK APIs require iOS 18.0+.
Public initializer
import CoreLocation
import UIKit
import GraffityARCloud
@MainActor
func makeNavigationSession(accessToken: String) throws -> GraffityARCloud {
let configuration = GraffityARCloudConfiguration(
accessToken: accessToken,
mode: .navigation,
userId: "YOUR_USER_ID",
initialLocation: CLLocation(latitude: 13.7563, longitude: 100.5018),
logging: .default,
telemetry: .disabled,
minimap: .enabled,
theme: GraffityARTheme(primary: .systemIndigo),
preferredTransitionTypeId: nil,
deepLink: nil
)
return try GraffityARCloud(configuration: configuration)
}Replace the seed coordinate with a known location for your user, or omit it. Use your app’s stable player ID, or omit it when collection is not needed.
| Parameter | Type | Default | Effect |
|---|---|---|---|
accessToken | String | Required | Graffity-issued token; basic validation runs in the SDK initializer. |
mode | GraffityARMode | .navigation | Destination-first navigation, or immediate localization with .arContent. |
userId | String? | nil | User-specific content and collection player identity. |
initialLocation | CLLocation? | nil | Seed before the first GPS fix; real updates take over. Does not bypass authorization. |
logging | GraffityARLogging | .default | Log sink and severity; see logging. |
telemetry | GraffityARTelemetry | .default → .disabled | Opt-in analytics, independent of required SDK requests and collection. |
minimap | GraffityARMinimapConfiguration | .disabled | Docked route map, honored only in navigation mode. |
theme | GraffityARTheme | .default | Native UI palette. |
preferredTransitionTypeId | String? | nil | Preferred transition type for every hop; backend falls back to the unrestricted shortest path if needed. |
deepLink | GraffityARDeepLink? | nil | Place, section, or POI for the first destination-picker presentation. |
Token validation
Initialization trims whitespace and an optional case-insensitive Bearer prefix for the basic check. The remaining token must be longer than 10 characters. This catches obvious missing or short input; it is not JWT verification or server authentication.
Pass the raw issued token without a prefix for consistent use across services. A later server rejection surfaces as .invalidAccessToken and triggers shutdown. There is no public token setter or refresh callback: obtain a new token and create a new session.
Configuration changes
The public initializer targets production. Environment selection and custom endpoints are internal SPI, outside the external developer API.
Properties use let. To change token, mode, user, location seed, minimap, theme, transition preference, or deep link, end the current session and create a new configuration and SDK. Use setLogger(_:) and setTelemetryEnabled(_:) for runtime sink and telemetry changes.
See navigation, collection, and lifecycle.