Property

public final class Property: CustomStringConvertible

Property instances represent properties persisted to Realm in the context of an object schema.

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

These property instances map to columns in the core database.

  • The name of the property.

    Declaration

    Swift

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

    Declaration

    Swift

    public var type: PropertyType { return rlmProperty.type }
  • Indicates whether this property is indexed.

    Declaration

    Swift

    public var indexed: Bool { return rlmProperty.indexed }
  • 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 optional: Bool { return rlmProperty.optional }
  • For Object and List properties, the name of the class of object stored in the property.

    Declaration

    Swift

    public var objectClassName: String? { return rlmProperty.objectClassName }
  • Returns a human-readable description of this property.

    Declaration

    Swift

    public var description: String { return rlmProperty.description }