Skip to Content
iOS OptionsContent Taps and URLs

Content taps and URL handling

Use GraffityARCloudDelegate for taps and links from AR content or the map. Assign it before presenting the SDK view. The SDK holds its delegate weakly; retain it in your app.

import Foundation import GraffityARCloud @MainActor final class ContentEvents: @preconcurrency GraffityARCloudDelegate { func graffityARCloud(_ sdk: GraffityARCloud, didTapContentWithId id: String) { print("Tapped content: \(id)") } func graffityARCloud( _ sdk: GraffityARCloud, requestsOpenURL url: URL, source: GraffityAROpenURLSource ) -> Bool { switch source { case .arContent(let contentId): print("Link from content: \(contentId)") case .map: print("Link from the map") } return false // Let the SDK open web links. } } @MainActor final class ContentSession { let events = ContentEvents() let sdk: GraffityARCloud init(accessToken: String) throws { sdk = try GraffityARCloud(configuration: GraffityARCloudConfiguration( accessToken: accessToken, mode: .arContent )) sdk.delegate = events } }

Retain ContentSession while hosting its SDK view. Both view factories share this delegate contract. The @preconcurrency conformance allows a main-actor handler to implement the current protocol, whose requirements are not actor-annotated.

Content behavior

Author content and tap effects in Graffity Console. didTapContentWithId supplies an ID, not a SceneKit node. This notification has no return value for suppressing built-in content effects.

Handle a URL in your app

requestsOpenURL runs at link-tap time. Return true when your app takes responsibility for opening or routing the URL. Return false, or omit the method, to use the SDK’s in-app browser for HTTP/HTTPS.

The default browser ignores other schemes. Handle custom schemes in your delegate and return true once handled. source distinguishes .map from .arContent(contentId:).

Implement only the delegate events you need; all have defaults. Collection reports didCollect; see activity collection.