added iOS source code
[wl-app.git] / iOS / Pods / Realm / include / RLMObjectSchema.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 RLMProperty;
24
25 /**
26  This class represents Realm model object schemas.
27
28  When using Realm, `RLMObjectSchema` instances allow performing migrations and
29  introspecting the database's schema.
30
31  Object schemas map to tables in the core database.
32  */
33 @interface RLMObjectSchema : NSObject<NSCopying>
34
35 #pragma mark - Properties
36
37 /**
38  An array of `RLMProperty` instances representing the managed properties of a class described by the schema.
39
40  @see `RLMProperty`
41  */
42 @property (nonatomic, readonly, copy) NSArray<RLMProperty *> *properties;
43
44 /**
45  The name of the class the schema describes.
46  */
47 @property (nonatomic, readonly) NSString *className;
48
49 /**
50  The property which serves as the primary key for the class the schema describes, if any.
51  */
52 @property (nonatomic, readonly, nullable) RLMProperty *primaryKeyProperty;
53
54 #pragma mark - Methods
55
56 /**
57  Retrieves an `RLMProperty` object by the property name.
58
59  @param propertyName The property's name.
60
61  @return An `RLMProperty` object, or `nil` if there is no property with the given name.
62  */
63 - (nullable RLMProperty *)objectForKeyedSubscript:(NSString *)propertyName;
64
65 /**
66  Returns whether two `RLMObjectSchema` instances are equal.
67  */
68 - (BOOL)isEqualToObjectSchema:(RLMObjectSchema *)objectSchema;
69
70 @end
71
72 NS_ASSUME_NONNULL_END