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
23 @class RLMObjectSchema;
26 `RLMSchema` instances represent collections of model object schemas managed by a Realm.
28 When using Realm, `RLMSchema` instances allow performing migrations and
29 introspecting the database's schema.
31 Schemas map to collections of tables in the core database.
33 @interface RLMSchema : NSObject<NSCopying>
35 #pragma mark - Properties
38 An `NSArray` containing `RLMObjectSchema`s for all object types in the Realm.
40 This property is intended to be used during migrations for dynamic introspection.
42 @see `RLMObjectSchema`
44 @property (nonatomic, readonly, copy) NSArray<RLMObjectSchema *> *objectSchema;
46 #pragma mark - Methods
49 Returns an `RLMObjectSchema` for the given class name in the schema.
51 @param className The object class name.
52 @return An `RLMObjectSchema` for the given class in the schema.
54 @see `RLMObjectSchema`
56 - (nullable RLMObjectSchema *)schemaForClassName:(NSString *)className;
59 Looks up and returns an `RLMObjectSchema` for the given class name in the Realm.
61 If there is no object of type `className` in the schema, an exception will be thrown.
63 @param className The object class name.
64 @return An `RLMObjectSchema` for the given class in this Realm.
66 @see `RLMObjectSchema`
68 - (RLMObjectSchema *)objectForKeyedSubscript:(NSString *)className;
71 Returns whether two `RLMSchema` instances are equivalent.
73 - (BOOL)isEqualToSchema:(RLMSchema *)schema;