RLMRealmConfiguration
@interface RLMRealmConfiguration : NSObject <NSCopying>
An RLMRealmConfiguration
is used to describe the different options used to
create an RLMRealm
instance.
RLMRealmConfiguration
instances are just plain NSObjects, and unlike RLMRealm
and RLMObjects can be freely shared between threads as long as you do not
mutate them. Creating configuration objects for class subsets (by setting the
objectClasses
property) can be expensive, and so you will normally want to
cache and reuse a single configuration object for each distinct configuration
that you are using rather than creating a new one each time you open a Realm.
-
Returns the default configuration used to create Realms when no other configuration is explicitly specified (i.e.
+[RLMRealm defaultRealm]
).Declaration
Objective‑C
+ (nonnull instancetype)defaultConfiguration;
Swift
class func defaultConfiguration() -> Self
Return Value
The default Realm configuration.
-
Sets the default configuration to the given
RLMRealmConfiguration
.Declaration
Objective‑C
+ (void)setDefaultConfiguration:(nonnull RLMRealmConfiguration *)configuration;
Swift
class func setDefaultConfiguration(configuration: RLMRealmConfiguration)
Parameters
configuration
The new default Realm configuration.
-
The local URL to the realm file. Mutually exclusive with
inMemoryIdentifier
.Declaration
Objective‑C
@property (readwrite, copy, nonatomic, nullable) NSURL *fileURL;
Swift
@NSCopying var fileURL: NSURL? { get set }
-
A string used to identify a particular in-memory Realm. Mutually exclusive with
path
.Declaration
Objective‑C
@property (readwrite, copy, nonatomic, nullable) NSString *inMemoryIdentifier;
Swift
var inMemoryIdentifier: String? { get set }
-
64-byte key to use to encrypt the data.
Declaration
Objective‑C
@property (readwrite, copy, nonatomic, nullable) NSData *encryptionKey;
Swift
@NSCopying var encryptionKey: NSData? { get set }
-
Whether the Realm is read-only (must be YES for read-only files).
Declaration
Objective‑C
@property (assign, readwrite, nonatomic) BOOL readOnly;
Swift
var readOnly: Bool { get set }
-
The current schema version.
Declaration
Objective‑C
@property (assign, readwrite, nonatomic) uint64_t schemaVersion;
Swift
var schemaVersion: UInt64 { get set }
-
The block which migrates the Realm to the current version.
Declaration
Objective‑C
@property (readwrite, copy, nonatomic, nullable) RLMMigrationBlock migrationBlock;
-
Recreate the Realm file with the provided schema if a migration is required. This is the case when the stored schema differs from the provided schema or the stored schema version differs from the version on this configuration. This deletes the file if a migration would otherwise be required or run.
Note
This doesn’t disable file format migrations.Declaration
Objective‑C
@property (assign, readwrite, nonatomic) BOOL deleteRealmIfMigrationNeeded;
Swift
var deleteRealmIfMigrationNeeded: Bool { get set }
-
The classes persisted in the Realm.
Declaration
Objective‑C
@property (readwrite, copy, nonatomic, nullable) NSArray *objectClasses;
Swift
var objectClasses: [AnyObject]? { get set }