Skip to Content

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.

EventMeaning
didChangeStateThe public state snapshot changed.
didTapContentWithIdAn AR-content tap; does not suppress built-in effects.
didCollect:activity:A player collected content; inspect the returned activity for completion.
didLocalizeInVPS localized into the named section.
didStartNavigationToNavigation started toward a destination.
didArriveAtFinal destination arrival.
graffityARCloudDidStopNavigationNavigation stopped.
didFailWithA 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.