RLMSchema

@interface RLMSchema : NSObject <NSCopying>

This class represents the collection of model object schemas persisted to Realm.

When using Realm, RLMSchema objects 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 this Realm. Meant to be used during migrations for dynamic introspection.

    See

    RLMObjectSchema

    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 this RLMSchema.

    See

    RLMObjectSchema

    Declaration

    Objective‑C

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

    Swift

    func schemaForClassName(className: String) -> RLMObjectSchema?

    Parameters

    className

    The object class name.

    Return Value

    RLMObjectSchema for the given class in this RLMSchema.

  • Look up an RLMObjectSchema for the given class name in this Realm. Throws an exception if there is no object of type className in this RLMSchema instance.

    See

    RLMObjectSchema

    Declaration

    Objective‑C

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

    Swift

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

    Parameters

    className

    The object class name.

    Return Value

    RLMObjectSchema for the given class in this Realm.

  • Returns YES if equal to schema

    Declaration

    Objective‑C

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

    Swift

    func isEqualToSchema(schema: RLMSchema) -> Bool