Hi.
I’m using the same realm definition in my Android and iOS app and while on Android, the migration block easily allows adding new optional fields, I struggle to find a solution for how to achieve that in Swift.
This is how my realm object looks like, the last property is the one I want to add in the new version. It does not automatically get added to the table like @Persisted properties do. It cannot be tagged with @Persisted either. How do I solve this problem and add the column to the table?
class RelevantDO: Object {
@Persisted var name: String? = ""
@Persisted var count: Int = 0
let percentage = RealmProperty<Float?>()
...
My migration block in Java looks like this:
...
if (version == 53) {
schema.get(RelevantDO.class.getSimpleName())
.addField("percentage", Float.class)
.transform(obj -> obj.set("percentage", null));
version++;
}