1

Can someone please help me, Im new to swiftUI and I want to implement universal link for my app. I have prepared my AASA and also added associated domain to the app. But I am confused when it comes to the code in Scene delegate for opening the app when the link is clicked.

This would be the solution with uikit. But how would I do this with swiftUI?

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { return false }

This is what im trying

func scene(_ scene: UIScene, continue userActivity: NSUserActivity)
{
    guard userActivity.activityType == NSUserActivityTypeBrowsingWeb,
    let url = userActivity.webpageURL,
    let components = URLComponents(url: url, resolvingAgainstBaseURL: true) else
    {
        return
    }
    
    if let userActivity = scene.userActivity
    { 
        self.scene(scene, continue: userActivity)
    }
}
Johanna
  • 21
  • 3
  • Would you show your code? – Asperi Jul 08 '20 at 07:15
  • Take a look at the answers [here](https://stackoverflow.com/questions/58214733/application-continue-useractivity-method-not-called-in-ios-13). There are good examples on the use of scene delegate with Universal Links – Liaz Kamper Jul 08 '20 at 20:17

0 Answers0