I have a top level app struct that loo
@main
struct GuardianApp: App {
@UIApplicationDelegateAdaptor private var appDelegate: AppDelegate
let accountStore = AccountManager()
init() {
appDelegate.registerForPushNotifications()
}
...
When I register for push notifications and receive a device token (via didRegisterForRemoteNotificationsWithDeviceToken), I want to then call a method in AccountManager to use that token to register with my own server.
How do I properly make that connection? I do not
The app delegate class, for reference (which is successfully getting the token):
class AppDelegate: UIResponder, UIApplicationDelegate, ObservableObject {
@Published var deviceToken: Data?
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
self.deviceToken = deviceToken
}
...