Maximilian Pröll
10/19/2023, 11:39 AM// Create the request
let uuidString = UUID().uuidString
let request = UNNotificationRequest(identifier: uuidString,
content: content, trigger: trigger)
However, in Kotlin, there is no constructor with these parameters.
We only have:
public open expect class UNNotificationRequest : platform.darwin.NSObject, platform.Foundation.NSCopyingProtocol, platform.Foundation.NSSecureCodingProtocol {
@kotlin.commonizer.ObjCCallable public constructor(coder: platform.Foundation.NSCoder) { /* compiled code */ }
@kotlin.commonizer.ObjCCallable public constructor() { /* compiled code */ }
...
}
Also, the fields are val in the Kotlin platform file, so they cannot be reassigned:
public expect final val content: platform.UserNotifications.UNNotificationContent /* compiled code */
public expect final val identifier: kotlin.String /* compiled code */
public expect final val trigger: platform.UserNotifications.UNNotificationTrigger? /* compiled code */
So how would you implement that in the shared module?
I somehow need to do it that way, since I use compose multiplatform. So there is no swift UI from which the notification would be triggered.Daniel Seither
10/19/2023, 12:21 PMrequestWithIdentifier:content:trigger:
that you can call. I’ve not tried this from Kotlin though.