1 ////////////////////////////////////////////////////////////////////////////
3 // Copyright 2014 Realm Inc.
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
17 ////////////////////////////////////////////////////////////////////////////
19 #import <Foundation/Foundation.h>
21 NS_ASSUME_NONNULL_BEGIN
26 This class represents Realm model object schemas.
28 When using Realm, `RLMObjectSchema` instances allow performing migrations and
29 introspecting the database's schema.
31 Object schemas map to tables in the core database.
33 @interface RLMObjectSchema : NSObject<NSCopying>
35 #pragma mark - Properties
38 An array of `RLMProperty` instances representing the managed properties of a class described by the schema.
42 @property (nonatomic, readonly, copy) NSArray<RLMProperty *> *properties;
45 The name of the class the schema describes.
47 @property (nonatomic, readonly) NSString *className;
50 The property which serves as the primary key for the class the schema describes, if any.
52 @property (nonatomic, readonly, nullable) RLMProperty *primaryKeyProperty;
54 #pragma mark - Methods
57 Retrieves an `RLMProperty` object by the property name.
59 @param propertyName The property's name.
61 @return An `RLMProperty` object, or `nil` if there is no property with the given name.
63 - (nullable RLMProperty *)objectForKeyedSubscript:(NSString *)propertyName;
66 Returns whether two `RLMObjectSchema` instances are equal.
68 - (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema;