Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure @Dependency property and use BFS for DependencyManager #112

Merged
merged 18 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func swiftLintPlugin() -> [Target.PluginUsage] {

func swiftLintPackage() -> [PackageDescription.Package.Dependency] {
if ProcessInfo.processInfo.environment["SPEZI_DEVELOPMENT_SWIFTLINT"] != nil {
[.package(url: "https://github.com/realm/SwiftLint.git", .upToNextMinor(from: "0.55.1"))]
[.package(url: "https://github.com/realm/SwiftLint.git", from: "0.55.1")]
} else {
[]
}
Expand Down
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 @@ -22,6 +22,7 @@ public protocol NotificationHandler {
/// - Note: Notification Actions are not supported on `tvOS`.
///
/// - Parameter response: The user's response to the notification.
@MainActor
func handleNotificationAction(_ response: UNNotificationResponse) async
#endif

Expand All @@ -35,6 +36,7 @@ public protocol NotificationHandler {
///
/// - Parameter notification: The notification that is about to be delivered.
/// - Returns: The option for notifying the user. Use `[]` to silence the notification.
@MainActor
func receiveIncomingNotification(_ notification: UNNotification) async -> UNNotificationPresentationOptions?

#if !os(macOS)
Expand All @@ -51,6 +53,7 @@ public protocol NotificationHandler {
///
/// - Parameter remoteNotification: The data of the notification payload.
/// - Returns: Return the respective ``BackgroundFetchResult``.
@MainActor
func receiveRemoteNotification(_ remoteNotification: [AnyHashable: Any]) async -> BackgroundFetchResult
#else
/// Handle remote notification when the app is running in background.
Expand All @@ -62,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 All @@ -70,21 +74,25 @@ public protocol NotificationHandler {
extension NotificationHandler {
#if !os(tvOS)
/// Empty default implementation.
@MainActor
public func handleNotificationAction(_ response: UNNotificationResponse) async {}
#endif

/// Empty default implementation.
@MainActor
public func receiveIncomingNotification(_ notification: UNNotification) async -> UNNotificationPresentationOptions? {
nil
}

#if !os(macOS)
/// Empty default implementation.
@MainActor
public func receiveRemoteNotification(_ remoteNotification: [AnyHashable: Any]) async -> BackgroundFetchResult {
.noData
}
#else
/// Empty default implementation.
@MainActor
public func receiveRemoteNotification(_ remoteNotification: [AnyHashable: Any]) {}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import SwiftUI


enum ModifierPlacement: Int, Comparable {
/// No specific order requirement.
case regular
/// Outermost placement (e.g., @Model-based property wrappers).
case outermost

static func < (lhs: ModifierPlacement, rhs: ModifierPlacement) -> Bool {
Expand Down
Loading
Loading