How can MyApp receive and display a shared URL from Safari?

I would like to say in advance that I am totally new to iOS development and I have started online courses and reading documentation but the initial information is overwhelming, so any help with the following scenario is greatly appreciated. I also tried to search but the vast majority of examples are for content shared out of "MyApp".

  1. Given a simple iOS app MyApp with a single Text field
  2. When I open Safari and long tap on a link and select Share
  3. Then MyApp will appear in the list of potential sharing targets (like Messages for example)
  4. And when I select MyApp as the target
  5. Then MyApp will open and the Text field will display the received URL.

I learned quite a bit in the past few days. So separate Share To extension will allow to accept text/URL from another app. In addition, custom URL Type will allow MyApp to be opened from another app (tested with Safari).

Now so far, so good. I keep reading that Share To extension is not allowed to open its host app (MyApp) directly with openURL method. If this is true (and it appears to be), then what other way is there to force the Share To extension to open MyApp?

I'd love to know this as well. It seems that this should be simple, but it is surprisingly difficult. My understanding from the App Extension Programming Guide is that an app extension is not allowed to launch its containing app, or access the shared UIApplication instance, but every example that I've seen involves a hack to access UIApplication.sharedApplication (without actually calling that method), and then invoking openURL: on it to launch the containing app via an app-specific URL.

How can MyApp receive and display a shared URL from Safari?
 
 
Q