@@ -60,6 +60,7 @@ public struct APNSAlertNotificationContent: Encodable, Sendable {
60
60
case subtitleLocalizationArguments = " subtitle-loc-args "
61
61
case bodyLocalizationKey = " loc-key "
62
62
case bodyLocalizationArguments = " loc-args "
63
+ case sound
63
64
}
64
65
65
66
/// 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 {
76
77
/// the contents of the specified image or storyboard file are displayed instead of your app’s normal launch image.
77
78
public var launchImage : String ?
78
79
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
+
79
86
/// Initializes a new ``APNSAlertNotificationContent``.
80
87
///
81
88
/// - Parameters:
@@ -87,12 +94,14 @@ public struct APNSAlertNotificationContent: Encodable, Sendable {
87
94
title: APNSAlertNotificationContent . StringValue ? = nil ,
88
95
subtitle: APNSAlertNotificationContent . StringValue ? = nil ,
89
96
body: APNSAlertNotificationContent . StringValue ? = nil ,
90
- launchImage: String ? = nil
97
+ launchImage: String ? = nil ,
98
+ sound: APNSAlertNotificationSound ? = nil
91
99
) {
92
100
self . title = title
93
101
self . subtitle = subtitle
94
102
self . body = body
95
103
self . launchImage = launchImage
104
+ self . sound = sound
96
105
}
97
106
98
107
public func encode( to encoder: Encoder ) throws {
@@ -120,6 +129,7 @@ public struct APNSAlertNotificationContent: Encodable, Sendable {
120
129
localizedArgumentsKey: . bodyLocalizationArguments
121
130
)
122
131
try container. encodeIfPresent ( self . launchImage, forKey: . launchImage)
132
+ try container. encodeIfPresent ( self . sound, forKey: . sound)
123
133
}
124
134
125
135
private func encode(
0 commit comments