RLMObjectSchema

Objective-C


@interface RLMObjectSchema : NSObject <NSCopying>

Swift

@_nonSendable(_assumed) class RLMObjectSchema : NSObject, NSCopying, @unchecked Sendable

This class represents Realm model object schemas.

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

Object schemas map to tables in the core database.

Properties

  • An array of RLMProperty instances representing the managed properties of a class described by the schema.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSArray<RLMProperty *> *_Nonnull properties;

    Swift

    var properties: [RLMProperty] { get }
  • The name of the class the schema describes.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSString *_Nonnull className;

    Swift

    var className: String { get }
  • The property which serves as the primary key for the class the schema describes, if any.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) RLMProperty *primaryKeyProperty;

    Swift

    var primaryKeyProperty: RLMProperty? { get }
  • Whether this object type is embedded.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isEmbedded;

    Swift

    var isEmbedded: Bool { get }
  • Whether this object is asymmetric.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL isAsymmetric;

    Swift

    var isAsymmetric: Bool { get }

Methods

  • Retrieves an RLMProperty object by the property name.

    Declaration

    Objective-C

    - (nullable RLMProperty *)objectForKeyedSubscript:
        (nonnull NSString *)propertyName;

    Swift

    subscript(propertyName: String) -> RLMProperty? { get }

    Parameters

    propertyName

    The property’s name.

    Return Value

    An RLMProperty object, or nil if there is no property with the given name.

  • Returns whether two RLMObjectSchema instances are equal.

    Declaration

    Objective-C

    - (BOOL)isEqualToObjectSchema:(nonnull RLMObjectSchema *)objectSchema;

    Swift

    func isEqual(to objectSchema: RLMObjectSchema) -> Bool