Great question!

First, how to get the link that the app was launched from, if any.

Answer: Inside your App struct, implement the .onOpenURL view modifier on ContentView:

Left: when launched from a link. Right: when launched directly from the home screen.

Second, how to monitor device rotation

Answer: There’s a lot of ways to do this, but the easiest is to use a notification publisher. Here’s what ContentView will look like:

Source from Koraktor’s great Stack Overflow answer

--

--

WWDC21 Scholar. I like to read manga and write about Swift. Check out my app, Find — look for text in real life, with outrageous speed. getfind.app

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrew Zheng

WWDC21 Scholar. I like to read manga and write about Swift. Check out my app, Find — look for text in real life, with outrageous speed. getfind.app