We\'re building a today widget on top of our iOS app which is working with Firebase. However we\'re struggling to access current signed-in user from the extension. The user
You can share data between Host App
and App Extension
only using App Group
.
There is no way of direct communication between your Host App
and App Extension
.
Even though an app extension bundle is nested within its containing app’s bundle, the running app extension and containing app have no direct access to each other’s containers.
App Group
is a shared container
used by both Host App
as well as App Extension
. It is like UserDefaults
that store key-value pairs
.
So you can save your current user information in App Group
from Host App
and then access it in your Today Extension
from the same App Group
.
For more on App Groups
refer to: https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html