I've a containing App and a Siri Extension for this App.
From the App a user can call some online API, let's say that it calls the API example.com/postsomething
with an authenticated call using a token obtained after a login.
Now which is the best way to have a Siri Extension calling the same API? should I import all the code used by the App in the Siri Extension!? it sounds so bad...
Is UserActivity the only other available option? from my understanding an Extension (Watch extension and Today extension aside) cannot communicate back with the containing App in any way.
The best approach IMHO is to use frameworks to share code between your main application and your extensions, as for sharing data like the login token for example you can use Keychain with a shared group. Please find more information here : https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html