'instantiate a viewController func in appDelegate in swift ios
I am new to swift iOS and I am not able to call a func in view controller from AppDelegate to activate at certain point in background in macOS bigsur
In my appDelegate I have below the following:
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
// new notifications from background
.myNotifications() // a func in called in my viewController
}
Solution 1:[1]
Just call the func from an initiation of your view controller instead
YourViewController().myNotifications()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | BPS |
