I want to use realm to save data but as far as I understand realm does not support CGFloat
and Color
property, I searched for solution but it seems there is no answer.
Saving properties not supported by RealmSwift
In documentation said : “CGFloat properties are discouraged, as the type is not platform independent.”
In my app I use DragGesture and the value that returns for width
and height
are CGFloat this is my struct:
struct Card : Identifiable {
var id = UUID()
var name : String
var color : Color
var y : CGFloat = 0
var x : CGFloat = 0
}
and DB so far :
class cardDB : Object {
@objc dynamic var id = UUID()
@objc dynamic var name = ""
}
Is there any way to save these two property to realm DB?