我需要将typealias
到CloudKit
保存为类型Bytes
的字段。
我能够成功地将typealias
转换为类型Data
的对象。我该如何将Data
类型的对象转换为typealias
的对象?
typealias NotificationIdentifiers = [[String]?]
var notificationIdentifiers: NotificationIdentifiers = [nil, [UUID().uuidString], [UUID().uuidString], [UUID().uuidString], [UUID().uuidString], [UUID().uuidString], [UUID().uuidString]]
let unsafeNIPointer: UnsafePointer<NotificationIdentifiers> = UnsafePointer<NotificationIdentifiers>(¬ificationIdentifiers)
let unsafeNIBufferPointer: UnsafeBufferPointer<NotificationIdentifiers> = UnsafeBufferPointer<NotificationIdentifiers>(start: unsafeNIPointer, count: 1)
let dataNotificationIdentifiers: Data = Data(buffer: unsafeNIBufferPointer)