RealmProperty

A RealmProperty instance represents an polymorphic value for supported types.

To change the underlying value stored by a RealmProperty instance, mutate the instance’s value property.

Note

An RealmProperty should not be declared as @objc dynamic on a Realm Object. Use let instead.
  • Used for getting / setting the underlying value.

    • Usage: class MyObject: Object { let myAnyValue = RealmProperty<AnyRealmValue>() } // Setting myObject.myAnyValue.value = .string("hello") // Getting if case let .string(s) = myObject.myAnyValue.value { print(s) // Prints 'Hello' }