RealmProperty

public final class RealmProperty<Value> : RLMSwiftValueStorage where Value : RealmPropertyType
extension RealmProperty: Equatable where Value: Equatable
extension RealmProperty: Codable where Value: Codable

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' }

    Declaration

    Swift

    public var value: Value { get set }

Available where Value: Equatable

  • Declaration

    Swift

    public static func == (lhs: RealmProperty<Value>, rhs: RealmProperty<Value>) -> Bool

Available where Value: Codable