RealmProperty
public final class RealmProperty<Value> : RLMSwiftValueStorage where Value : RealmPropertyType, Value : _RealmSchemaDiscoverable
extension RealmProperty: Equatable where Value: Equatable
extension RealmProperty: Codable where Value: Codable, Value: _RealmSchemaDiscoverable
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
AnRealmProperty
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 }
- Usage:
-
Declaration
Swift
public static func == (lhs: RealmProperty<Value>, rhs: RealmProperty<Value>) -> Bool
-
Declaration
Swift
public convenience init(from decoder: Decoder) throws
-
Declaration
Swift
public func encode(to encoder: Encoder) throws