RLMSchema

@interface RLMSchema : NSObject <NSCopying>

RLMSchema instances represent collections of model object schemas persisted to a Realm.

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

Schemas map to collections of tables in the core database.

  • An NSArray containing RLMObjectSchemas for all object types in the Realm.

    This property is intended to be used during migrations for dynamic introspection.

    Declaration

    Objective‑C

    @property (readonly, copy, nonatomic)
        NSArray<RLMObjectSchema *> *_Nonnull objectSchema;

    Swift

    var objectSchema: [RLMObjectSchema] { get }
  • Returns an RLMObjectSchema for the given class name in the schema.

    Declaration

    Objective‑C

    - (nullable RLMObjectSchema *)schemaForClassName:(nonnull NSString *)className;

    Swift

    func schemaForClassName(className: String) -> RLMObjectSchema?

    Parameters

    className

    The object class name.

    Return Value

    An RLMObjectSchema for the given class in the schema.

  • Looks up and returns an RLMObjectSchema for the given class name in the Realm.

    If there is no object of type className in the schema, an exception will be thrown.

    Declaration

    Objective‑C

    - (nonnull RLMObjectSchema *)objectForKeyedSubscript:
        (nonnull id<NSCopying>)className;

    Swift

    subscript (className: NSCopying) -> RLMObjectSchema { get }

    Parameters

    className

    The object class name.

    Return Value

    An RLMObjectSchema for the given class in this Realm.

  • Returns a Boolean value that indicates whether two RLMSchema instances are equivalent.

    Declaration

    Objective‑C

    - (BOOL)isEqualToSchema:(nonnull RLMSchema *)schema;

    Swift

    func isEqualToSchema(schema: RLMSchema) -> Bool