added iOS source code
[wl-app.git] / iOS / Pods / Realm / include / RLMSchema.h
1 ////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright 2014 Realm Inc.
4 //
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
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
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.
16 //
17 ////////////////////////////////////////////////////////////////////////////
18
19 #import <Foundation/Foundation.h>
20
21 NS_ASSUME_NONNULL_BEGIN
22
23 @class RLMObjectSchema;
24
25 /**
26  `RLMSchema` instances represent collections of model object schemas managed by a Realm.
27
28  When using Realm, `RLMSchema` instances allow performing migrations and
29  introspecting the database's schema.
30
31  Schemas map to collections of tables in the core database.
32  */
33 @interface RLMSchema : NSObject<NSCopying>
34
35 #pragma mark - Properties
36
37 /**
38  An `NSArray` containing `RLMObjectSchema`s for all object types in the Realm.
39
40  This property is intended to be used during migrations for dynamic introspection.
41
42  @see `RLMObjectSchema`
43  */
44 @property (nonatomic, readonly, copy) NSArray<RLMObjectSchema *> *objectSchema;
45
46 #pragma mark - Methods
47
48 /**
49  Returns an `RLMObjectSchema` for the given class name in the schema.
50
51  @param className   The object class name.
52  @return            An `RLMObjectSchema` for the given class in the schema.
53
54  @see               `RLMObjectSchema`
55  */
56 - (nullable RLMObjectSchema *)schemaForClassName:(NSString *)className;
57
58 /**
59  Looks up and returns an `RLMObjectSchema` for the given class name in the Realm.
60
61  If there is no object of type `className` in the schema, an exception will be thrown.
62
63  @param className   The object class name.
64  @return            An `RLMObjectSchema` for the given class in this Realm.
65
66  @see               `RLMObjectSchema`
67  */
68 - (RLMObjectSchema *)objectForKeyedSubscript:(NSString *)className;
69
70 /**
71  Returns whether two `RLMSchema` instances are equivalent.
72  */
73 - (BOOL)isEqualToSchema:(RLMSchema *)schema;
74
75 @end
76
77 NS_ASSUME_NONNULL_END