AnyRealmValue
public enum AnyRealmValue : Hashable
extension AnyRealmValue: _QueryNumeric
extension AnyRealmValue: RealmCollectionValue
extension AnyRealmValue: RealmPropertyType
extension AnyRealmValue: MinMaxType
extension AnyRealmValue: AddableType
extension AnyRealmValue: SortableType
A enum for storing and retrieving values associated with an AnyRealmValue
property.
AnyRealmValue
can also store a collection (List, Dictionary) of AnyRealmValue
, meaning that you can have
nested collections inside a AnyRealmValue
.
-
Represents
nil
Declaration
Swift
case none
-
An integer type.
Declaration
Swift
case int(Int)
-
A boolean type.
Declaration
Swift
case bool(Bool)
-
A floating point numeric type.
Declaration
Swift
case float(Float)
-
A double numeric type.
Declaration
Swift
case double(Double)
-
A string type.
Declaration
Swift
case string(String)
-
A binary data type.
Declaration
Swift
case data(Data)
-
A date type.
Declaration
Swift
case date(Date)
-
A Realm Object type.
Declaration
Swift
case object(Object)
-
An ObjectId type.
Declaration
Swift
case objectId(ObjectId)
-
A Decimal128 type.
Declaration
Swift
case decimal128(Decimal128)
-
A UUID type.
Declaration
Swift
case uuid(UUID)
-
Dictionary type.
Declaration
Swift
case dictionary(Map<String, AnyRealmValue>)
-
List type.
Declaration
Swift
case list(List<AnyRealmValue>)
-
Returns an
Int
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var intValue: Int? { get }
-
Returns a
Bool
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var boolValue: Bool? { get }
-
Returns a
Float
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var floatValue: Float? { get }
-
Returns a
Double
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var doubleValue: Double? { get }
-
Returns a
String
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var stringValue: String? { get }
-
Returns
Data
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var dataValue: Data? { get }
-
Returns a
Date
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var dateValue: Date? { get }
-
Returns a
Decimal128
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var decimal128Value: Decimal128? { get }
-
Returns a
UUID
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var uuidValue: UUID? { get }
-
Returns the stored value as a Realm Object of a specific type.
Declaration
Swift
public func object<T>(_ objectType: T.Type) -> T? where T : RealmSwiftObject
Parameters
objectType
The type of the Object to return.
Return Value
A Realm Object of the supplied type if that is what the underlying value is, otherwise
nil
is returned. -
Returns a
Map<String, AnyRealmValue>
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var dictionaryValue: Map<String, AnyRealmValue>? { get }
-
Returns a
List<AnyRealmValue>
if that is what the stored value is, otherwisenil
.Declaration
Swift
public var listValue: List<AnyRealmValue>? { get }
-
Returns a
DynamicObject
if the stored value is anObject
, otherwisenil
.Note: This allows access to an object stored in
AnyRealmValue
where you may not have the class information associated for it. For example if you are using Realm Sync and version 2 of your app sets an object intoAnyRealmValue
and that class does not exist in version 1 use this accessor to gain access to the object in the Realm.Declaration
Swift
public var dynamicObject: DynamicObject? { get }
-
Required for conformance to
AddableType
Declaration
Swift
public init()
-
Declaration
Swift
public func hash(into hasher: inout Hasher)