Property

@frozen
public struct Property : CustomStringConvertible
extension Property: Equatable

Property instances represent properties managed by a Realm in the context of an object schema. Such properties may be persisted to a Realm file or computed from other data in the Realm.

When using Realm, property instances allow performing migrations and introspecting the database’s schema.

Property instances map to columns in the core database.

Properties

  • The name of the property.

    Declaration

    Swift

    public var name: String { get }
  • The type of the property.

    Declaration

    Swift

    public var type: PropertyType { get }
  • Indicates whether this property is an array of the property type.

    Declaration

    Swift

    public var isArray: Bool { get }
  • Indicates whether this property is a set of the property type.

    Declaration

    Swift

    public var isSet: Bool { get }
  • Indicates whether this property is indexed.

    Declaration

    Swift

    public var isIndexed: Bool { get }
  • Indicates whether this property is optional. (Note that certain numeric types must be wrapped in a RealmOptional instance in order to be declared as optional.)

    Declaration

    Swift

    public var isOptional: Bool { get }
  • For Object and List properties, the name of the class of object stored in the property.

    Declaration

    Swift

    public var objectClassName: String? { get }
  • A human-readable description of the property object.

    Declaration

    Swift

    public var description: String { get }

Equatable

  • Returns whether the two properties are equal.

    Declaration

    Swift

    public static func == (lhs: Property, rhs: Property) -> Bool