bfgSettings Class
Stores settings to disk automatically so that other libraries can use keys to retrieve them. More...
#import <bfgsettings.h>
Class Methods | |
(BOOL) | + canUseStorageType: |
(BOOL) | + write |
(BOOL) | + writeStorageType: |
(void) | + set:value: |
(void) | + set:value:storageType: |
(id _Nullable) | + get: |
(id _Nullable) | + get:storageType: |
(id _Nullable) | + get:withDefault: |
(id _Nullable) | + get:withDefault:storageType: |
(BOOL) | + isPersistable:storageType: |
(id _Nullable) | + get:ofType: |
(id _Nullable) | + get:ofType:withDefault: |
(id _Nullable) | + get:ofType:withDefault:storageType: |
(id _Nullable) | + get:ofType:storageType: |
(id _Nullable) | + get:ofType:withDefault:storageType:error: |
(NSString *_Nullable) | + filePathforDiskMappedResource: |
Detailed Description
Stores settings to disk automatically so that other libraries can use keys to retrieve them. Developers can use this class to store settings used in their own libraries.
Method Documentation
◆ canUseStorageType:
+ (BOOL) canUseStorageType: | (bfgSettingsStorageType) | storageType |
- Returns
- Is this storage type available for use?
- Return values
YES Storage type is available for use. NO Storage type is not available for use.
- Since
- 4.7
◆ filePathforDiskMappedResource:
+ (NSString *_Nullable) filePathforDiskMappedResource: | (NSString *_Nonnull) | key |
Gets the file path for a resource persisted through bfgDiskMappedPersister
- Parameters
key The key used to write and retreive the value from the persisted store.
- Returns
- The file path for the resource or nil if the resouce cannot be found.
- Since
- 6.6
◆ get:
+ (id _Nullable) get: | (NSString *_Nonnull) | key |
Gets a setting value for a key from the settings plist.
- Parameters
key The key for the value to be retrieved.
- Returns
- The value from the settings.
- Since
- 2.2
◆ get:ofType:
+ (id _Nullable) get: | (NSString *_Nonnull) | key | |
ofType: | (Class _Nonnull) | type | |
Gets a settings value for a key and checks the type of the retrieved value against the passed in type parameter.
- Parameters
key The key for the value to be retrieved. type The desired object type of the retrieved value.
- Returns
- The value from settings, or nil if the object type of the value and passed in type parameter do not match.
◆ get:ofType:storageType:
+ (id _Nullable) get: | (NSString *_Nonnull) | key | |
ofType: | (Class _Nonnull) | type | |
storageType: | (bfgSettingsStorageType) | storageType | |
Gets a settings value for a key from the requested store and checks the type of the retrieved value against the passed in type parameter.
- Parameters
key The key for the value to be retrieved. type The desired object type of the retrieved value. storageType The medium on which to persist the values (plist, local keychain, etc.).
- Returns
- The value from settings, or nil if the object type of the retrieved value and the passed in type parameter do not match.
- Since
- 6.0
◆ get:ofType:withDefault:
+ (id _Nullable) get: | (NSString *_Nonnull) | key | |
ofType: | (Class _Nonnull) | type | |
withDefault: | (id _Nullable) | defaultValue | |
Gets a settings value for a key and checks the type of the retrieved value against the passed in type parameter. Allows for a default value if the key does not exist.
- Parameters
key The key for the value to be retrieved. type The desired object type of the retrieved value. defaultValue The default value to be returned when no value is set for the key or the retrieved values' object type does not match the passed in type parameter.
- Returns
- The value from settings, or defaultValue if either the object type of the retrieved value and type parameter do not match or if no value is set for the key.
- Since
- 6.0
◆ get:ofType:withDefault:storageType:
+ (id _Nullable) get: | (NSString *_Nonnull) | key | |
ofType: | (Class _Nonnull) | type | |
withDefault: | (id _Nullable) | defaultValue | |
storageType: | (bfgSettingsStorageType) | storageType | |
Gets a settings value for a key from the requested store and checks the type of the retrieved value against the passed in type parameter. Allows for a default value if the key does not exist.
- Parameters
key The key for the value to be retrieved. type The desired object type of the retrieved value. defaultValue The default value to be returned when no value is set for the key or the retrieved value's object type does not match the passed in type parameter. storageType The medium on which to persist the values (plist, local keychain, etc.).
- Returns
- The value from settings, or defaultValue if either the object type of the retrieved value and type parameter do not match or if no value is set for the key.
- Since
- 6.0