Skip to content

Commit 3237bbe

Browse files
committed
Attempt to fix remote crash with SwiftUI transferable
1 parent a201ce2 commit 3237bbe

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Sources/ColorPaletteCodable/color/PAL+Color+Transferable.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import CoreTransferable
4444
@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *)
4545
extension PAL.Color: Transferable {
4646
public static var transferRepresentation: some TransferRepresentation {
47-
4847
// Our custom PAL.Color transfer type (basically a JSON encoded PAL.Color object)
4948
DataRepresentation(contentType: .palColor) { color in
5049
try JSONEncoder().encode(color)
@@ -54,15 +53,11 @@ extension PAL.Color: Transferable {
5453

5554
#if os(macOS)
5655
// Also add an NSColor representation if we're on macOS
57-
DataRepresentation(contentType: .systemColor) { color in
56+
DataRepresentation(exportedContentType: .systemColor) { color in
5857
guard let c = color.nsColor else { throw PAL.CommonError.cannotCreateColor }
5958
let n = NSKeyedArchiver(requiringSecureCoding: true)
6059
n.encodeRootObject(c)
6160
return n.encodedData
62-
} importing: { data in
63-
let n = NSKeyedUnarchiver()
64-
guard let color = n.decodeObject() as? NSColor else { throw PAL.CommonError.cannotCreateColor }
65-
return try PAL.Color(color: color)
6661
}
6762
#endif
6863
}

0 commit comments

Comments
 (0)