When the AppClips open, I want to read the value of the token from the link => https://example.com/token=12ds234vssd
This is SwiftUI example:
var body: some Scene
{
WindowGroup
{
ContentView().onContinueUserActivity(NSUserActivityTypeBrowsingWeb, perform: handleUserActivity)
}
}
func handleUserActivity(_ userActivity: NSUserActivity)
{
guard let incomingURL = userActivity.webpageURL,
let components = NSURLComponents(url: incomingURL, resolvingAgainstBaseURL: true),
let queryItems = components.queryItems else
{
return
}
// Configure App Clip with query items
print(String(queryItems))
}
How do I write using a UIKit?
Can I write the same syntax on the UIKit?
Scene Delegate:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
for activity in connectionOptions.userActivities where activity.activityType == NSUserActivityTypeBrowsingWeb {
let appClipCodeURL = activity.webpageURL
print("appClipCodeURL: \(appClipCodeURL)")
}
}