@@ -60,6 +60,7 @@ public struct APNSAlertNotificationContent: Encodable, Sendable {
6060 case subtitleLocalizationArguments = " subtitle-loc-args "
6161 case bodyLocalizationKey = " loc-key "
6262 case bodyLocalizationArguments = " loc-args "
63+ case sound
6364 }
6465
6566 /// The title of the notification. Apple Watch displays this string in the short look notification interface.
@@ -76,6 +77,12 @@ public struct APNSAlertNotificationContent: Encodable, Sendable {
7677 /// the contents of the specified image or storyboard file are displayed instead of your app’s normal launch image.
7778 public var launchImage : String ?
7879
80+ /// For regular notifications, use ``APNSAlertNotificationSound/fileName(_:)`` to specify the name of a sound file in your app's main bundle
81+ /// or in the Library/Sounds folder of your app's container directory.
82+ /// Use ``APNSAlertNotificationSound/default`` to play the system sound.
83+ /// Use this key for regular notifications. For critical alerts, use ``APNSAlertNotificationSound/critical(fileName:volume:)`` instead.
84+ public var sound : APNSAlertNotificationSound ?
85+
7986 /// Initializes a new ``APNSAlertNotificationContent``.
8087 ///
8188 /// - Parameters:
@@ -87,12 +94,14 @@ public struct APNSAlertNotificationContent: Encodable, Sendable {
8794 title: APNSAlertNotificationContent . StringValue ? = nil ,
8895 subtitle: APNSAlertNotificationContent . StringValue ? = nil ,
8996 body: APNSAlertNotificationContent . StringValue ? = nil ,
90- launchImage: String ? = nil
97+ launchImage: String ? = nil ,
98+ sound: APNSAlertNotificationSound ? = nil ,
9199 ) {
92100 self . title = title
93101 self . subtitle = subtitle
94102 self . body = body
95103 self . launchImage = launchImage
104+ self . sound = sound
96105 }
97106
98107 public func encode( to encoder: Encoder ) throws {
@@ -120,6 +129,7 @@ public struct APNSAlertNotificationContent: Encodable, Sendable {
120129 localizedArgumentsKey: . bodyLocalizationArguments
121130 )
122131 try container. encodeIfPresent ( self . launchImage, forKey: . launchImage)
132+ try container. encodeIfPresent ( self . sound, forKey: . sound)
123133 }
124134
125135 private func encode(
0 commit comments