Skip to content

Commit

Permalink
Clarify configuration documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
segiddins committed Aug 11, 2015
1 parent f9c0de1 commit 2e940b0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Realm/RLMConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RLM_ASSUME_NONNULL_BEGIN

/**
Returns the default configuration used to create Realms when no other
configuration is explicitly specified.
configuration is explicitly specified (i.e. `+[RLMRealm defaultRealm]`).
@return The default Realm configuration.
*/
Expand All @@ -40,12 +40,12 @@ RLM_ASSUME_NONNULL_BEGIN
@param configuration The new default Realm configuration.
*/
+ (void)setDefaultConfiguration:(nullable RLMConfiguration *)configuration;
+ (void)setDefaultConfiguration:(RLMConfiguration *)configuration;

/// The path to the realm file.
/// The path to the realm file. Mutually exclusive with `inMemoryIdentifier`.
@property (nonatomic, copy, nullable) NSString *path;

/// A string used to identify a particular in-memory Realm.
/// A string used to identify a particular in-memory Realm. Mutually exclusive with `path`.
@property (nonatomic, copy, nullable) NSString *inMemoryIdentifier;

/// 64-byte key to use to encrypt the data.
Expand Down
5 changes: 4 additions & 1 deletion Realm/RLMConfiguration.mm
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ + (void)setDefaultConfiguration:(RLMConfiguration *)configuration {
if (s_configurationUsage.exchange(RLMConfigurationUsageConfiguration) == RLMConfigurationUsagePerPath) {
@throw RLMException(@"Cannot set a default configuration after using per-path configuration methods.");
}
s_defaultConfiguration = [configuration copy] ?: [[RLMConfiguration alloc] init];
if (!configuration) {
@throw RLMException(@"Cannot set the default configuration to nil.");
}
s_defaultConfiguration = [configuration copy];
}

+ (void)setDefaultPath:(NSString *)path {
Expand Down
5 changes: 4 additions & 1 deletion RealmSwift-swift1.2/RealmConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public struct RealmConfiguration {

// MARK: Default Configuration

/// Returns the default Realm Configuration.
/// Returns the default RealmConfiguration used to create Realms when no other
/// configuration is explicitly specified (i.e. `Realm()`).
public static var defaultConfiguration: RealmConfiguration {
get {
return fromRLMConfiguration(RLMConfiguration.defaultConfiguration())
Expand Down Expand Up @@ -69,6 +70,7 @@ public struct RealmConfiguration {
// MARK: Configuration Properties

/// The path to the realm file.
/// Mutually exclusive with `inMemoryIdentifier`.
public var path: String? {
set {
if newValue != nil {
Expand All @@ -84,6 +86,7 @@ public struct RealmConfiguration {
private var _path: String?

/// A string used to identify a particular in-memory Realm.
/// Mutually exclusive with `path`.
public var inMemoryIdentifier: String? {
set {
if newValue != nil {
Expand Down
5 changes: 4 additions & 1 deletion RealmSwift-swift2.0/RealmConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public struct RealmConfiguration {

// MARK: Default Configuration

/// Returns the default Realm Configuration.
/// Returns the default RealmConfiguration used to create Realms when no other
/// configuration is explicitly specified (i.e. `Realm()`).
public static var defaultConfiguration: RealmConfiguration {
get {
return fromRLMConfiguration(RLMConfiguration.defaultConfiguration())
Expand Down Expand Up @@ -69,6 +70,7 @@ public struct RealmConfiguration {
// MARK: Configuration Properties

/// The path to the realm file.
/// Mutually exclusive with `inMemoryIdentifier`.
public var path: String? {
set {
if newValue != nil {
Expand All @@ -84,6 +86,7 @@ public struct RealmConfiguration {
private var _path: String?

/// A string used to identify a particular in-memory Realm.
/// Mutually exclusive with `path`.
public var inMemoryIdentifier: String? {
set {
if newValue != nil {
Expand Down

0 comments on commit 2e940b0

Please sign in to comment.