How do I switch from an iOS App I'm automating to Safari and paste a link there?

I’m currently automating an iOS app (android as well actually) and in this app I get an URL as part of a 2 factor authorisation process. Therefore I need to switch to safari/a browser and submit this URL. After that the app I’m testing should automatically open itself(if that doesn’t happen I would need to get back to the app again as well).

What is the best way to do this in Appium? I was thinking of making another AppiumDriver instance for the safari app, but I’m not sure this is the best way to do this.

I would appreciate any help on this, as well as useful links because I didn’t find too much on this topic.

What about using activate_app? It can call via mobile command or activate_app method if your client has the command.

The ruby text code launches via the command. The capability specifies