Extracted the in-app notifications from the Sample app target into its own Notifying package target.

This commit is contained in:
2026-07-05 13:33:07 +02:00
parent 6bcb88c944
commit 59b0237638
8 changed files with 278 additions and 106 deletions
@@ -0,0 +1,55 @@
import Foundation
/// A transient in-app notification, posted and dismissed by a ``Notifier``.
public struct AppNotification: Equatable, Identifiable, Sendable {
// MARK: Properties
/// The unique identifier of the notification.
public let id: UUID
/// The kind of the notification, driving its visual weight.
public let kind: Kind
/// The localized message of the notification.
public let message: String
/// The system symbol of the notification's icon.
public let symbol: String
// MARK: Initializers
/// Creates a notification of a given kind, with a localized message and a system symbol.
///
/// - Parameters:
/// - id: The unique identifier of the notification. Defaults to a newly generated identifier.
/// - kind: The kind of the notification.
/// - message: The localized message of the notification.
/// - symbol: The system symbol of the notification's icon.
public init(
id: UUID = .init(),
kind: Kind,
message: String,
symbol: String
) {
self.id = id
self.kind = kind
self.message = message
self.symbol = symbol
}
}
// MARK: - Enumerations
extension AppNotification {
/// The kind of a notification, driving its visual weight.
public enum Kind: Sendable {
/// The notification reports an error.
case error
/// The notification reports an informational event.
case info
/// The notification reports a warning.
case warning
}
}