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.

  • 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)
  • Returns an Int if that is what the stored value is, otherwise nil.

    Declaration

    Swift

    public var intValue: Int? { get }
  • Returns a Bool if that is what the stored value is, otherwise nil.

    Declaration

    Swift

    public var boolValue: Bool? { get }
  • Returns a Float if that is what the stored value is, otherwise nil.

    Declaration

    Swift

    public var floatValue: Float? { get }
  • Returns a Double if that is what the stored value is, otherwise nil.

    Declaration

    Swift

    public var doubleValue: Double? { get }
  • Returns a String if that is what the stored value is, otherwise nil.

    Declaration

    Swift

    public var stringValue: String? { get }
  • Returns Data if that is what the stored value is, otherwise nil.

    Declaration

    Swift

    public var dataValue: Data? { get }
  • Returns a Date if that is what the stored value is, otherwise nil.

    Declaration

    Swift

    public var dateValue: Date? { get }
  • Returns an ObjectId if that is what the stored value is, otherwise nil.

    Declaration

    Swift

    public var objectIdValue: ObjectId? { get }
  • Returns a Decimal128 if that is what the stored value is, otherwise nil.

    Declaration

    Swift

    public var decimal128Value: Decimal128? { get }
  • Returns a UUID if that is what the stored value is, otherwise nil.

    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 DynamicObject if the stored value is an Object, otherwise nil.

    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 into AnyRealmValue 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()