Created
September 8, 2022 14:41
-
-
Save nbhasin2/ea259cf61a85398db008ed4b3e9f2887 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
| //SceneDelegate | |
| func scene(_ scene: UIScene, continue userActivity: NSUserActivity) { | |
| // 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 | |
| } | |
| // Now that we have the url and its components, | |
| // we can use this information to present | |
| // appropriate content in the app | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment