GraffityARCloudDelegate
public protocol GraffityARCloudDelegate: AnyObject
Optional callbacks for an SDK session, available on iOS 18.0+. Set sdk.delegate before presenting and retain the delegate; the session’s reference is weak.
Callback signatures
The following declarations describe the protocol’s full callback surface. Every method has a default no-op implementation except URL requests, whose default returns false.
import Foundation
import GraffityARCloud
public protocol GraffityARCloudDelegate: AnyObject {
func graffityARCloud(_ sdk: GraffityARCloud, didChangeState state: GraffityARState)
func graffityARCloud(_ sdk: GraffityARCloud, didTapContentWithId id: String)
func graffityARCloud(
_ sdk: GraffityARCloud,
didCollect contentId: String,
activity: GraffityARActivity
)
func graffityARCloud(_ sdk: GraffityARCloud, didLocalizeIn sectionId: String)
func graffityARCloud(
_ sdk: GraffityARCloud,
didStartNavigationTo destination: GraffityARDestination
)
func graffityARCloud(
_ sdk: GraffityARCloud,
didArriveAt destination: GraffityARDestination
)
func graffityARCloudDidStopNavigation(_ sdk: GraffityARCloud)
func graffityARCloud(_ sdk: GraffityARCloud, didFailWith error: GraffityARCloudError)
func graffityARCloud(
_ sdk: GraffityARCloud,
requestsOpenURL url: URL,
source: GraffityAROpenURLSource
) -> Bool
}This declaration is provided by the SDK. Implement the callbacks you need on your delegate type.
| Event | Meaning |
|---|---|
didChangeState | The public state snapshot changed. |
didTapContentWithId | An AR-content tap; does not suppress built-in effects. |
didCollect:activity: | A player collected content; inspect the returned activity for completion. |
didLocalizeIn | VPS localized into the named section. |
didStartNavigationTo | Navigation started toward a destination. |
didArriveAt | Final destination arrival. |
graffityARCloudDidStopNavigation | Navigation stopped. |
didFailWith | A runtime error, also available in state. |
requestsOpenURL:source: | Link interception: true means handled by the host; false uses the SDK browser for HTTP/HTTPS. |
The SDK’s event plumbing runs on the main actor. The current protocol requirements themselves are not marked @MainActor; the examples use @preconcurrency GraffityARCloudDelegate on main-actor types for Swift 6 conformance.
State observation via Combine or AsyncStream can run alongside delegate callbacks. Those streams carry snapshots, while taps, collection, URL requests, and discrete navigation events use the delegate.
See tap and URL examples, collection, and state observation.