Created
September 8, 2022 14:33
-
-
Save nbhasin2/d6f37d61d2f12d0d9c582dfbcec5d29d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // AppDelegate | |
| func application(_ application: UIApplication, | |
| continue userActivity: NSUserActivity, | |
| restorationHandler: | |
| @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { | |
| // This will allow us to check if we are coming from a universal link | |
| // and get the url with its components | |
| // The activity type (NSUserActivityTypeBrowsingWeb) is used | |
| // when continuing from a web browsing session to either | |
| // a web browser or a native app. Only activities of this | |
| // type can be continued from a web browser to a native app. | |
| guard userActivity.activityType == NSUserActivityTypeBrowsingWeb, | |
| let url = userActivity.webpageURL, | |
| let components = URLComponents(url: url, | |
| resolvingAgainstBaseURL: true) else { | |
| return false | |
| } | |
| // Now that we have the url and its components, | |
| // we can use this information to present | |
| // appropriate content in the app | |
| return true | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment