Skip to content

Commit

Permalink
Adding more MainActor guarantees
Browse files Browse the repository at this point in the history
  • Loading branch information
Supereg committed Aug 11, 2024
1 parent ded33ca commit 37840e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Sources/Spezi/Capabilities/Lifecycle/LifecycleHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public protocol LifecycleHandler {
to access launchOptions in a platform independent way.
"""
)
@MainActor
func willFinishLaunchingWithOptions(_ application: UIApplication, launchOptions: [UIApplication.LaunchOptionsKey: Any])

/// Replicates the `sceneWillEnterForeground(_: UIScene)` functionality of the `UISceneDelegate`.
Expand All @@ -63,6 +64,7 @@ public protocol LifecycleHandler {
or other platform-specific mechanisms as a replacement.
"""
)
@MainActor
func sceneWillEnterForeground(_ scene: UIScene)

/// Replicates the `sceneDidBecomeActive(_: UIScene)` functionality of the `UISceneDelegate`.
Expand All @@ -78,6 +80,7 @@ public protocol LifecycleHandler {
or other platform-specific mechanisms as a replacement.
"""
)
@MainActor
func sceneDidBecomeActive(_ scene: UIScene)

/// Replicates the `sceneWillResignActive(_: UIScene)` functionality of the `UISceneDelegate`.
Expand All @@ -93,6 +96,7 @@ public protocol LifecycleHandler {
or other platform-specific mechanisms as a replacement.
"""
)
@MainActor
func sceneWillResignActive(_ scene: UIScene)

/// Replicates the `sceneDidEnterBackground(_: UIScene)` functionality of the `UISceneDelegate`.
Expand All @@ -108,6 +112,7 @@ public protocol LifecycleHandler {
or other platform-specific mechanisms as a replacement.
"""
)
@MainActor
func sceneDidEnterBackground(_ scene: UIScene)

/// Replicates the `applicationWillTerminate(_: UIApplication)` functionality of the `UIApplicationDelegate`.
Expand All @@ -123,6 +128,7 @@ public protocol LifecycleHandler {
or other platform-specific mechanisms as a replacement.
"""
)
@MainActor
func applicationWillTerminate(_ application: UIApplication)
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public protocol NotificationHandler {
/// [`application(_:didReceiveRemoteNotification:)`](https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428430-application).
///
/// - Parameter remoteNotification: The data of the notification payload.
@MainActor
func receiveRemoteNotification(_ remoteNotification: [AnyHashable: Any])
#endif
}
Expand Down

0 comments on commit 37840e3

Please sign in to comment.