Hi,
Overview:
I get the following error when trying to save / read from SwiftData
It happens when I try to save color to SwiftData (code below)
Error
'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
Questions
How can I resolve the error?
I am not directly using data, I am using just Float values, swift types. Why am I getting this error?
Is there a way to add a breakpoint to stop at the exact type causing the error? (Symbolic breakpoint doesn't seem to help)
Or is the below code ok and not responsible for the error?
Code
import SwiftUI
nonisolated struct ColorRepresentation: Codable {
let red: Float
let green: Float
let blue: Float
let opacity: Float
init(colorResolved: Color.Resolved) {
red = colorResolved.red
green = colorResolved.green
blue = colorResolved.blue
opacity = colorResolved.opacity
}
func color() throws -> Color {
Color(
red: Double(red),
green: Double(green),
blue: Double(blue),
opacity: Double(opacity)
)
}
}
extension ColorRepresentation: Equatable {}
4
0
60