PFConfig
Objective-C
@interface PFConfig : NSObject
Swift
class PFConfig : NSObject
PFConfig is a representation of the remote configuration object.
It enables you to add things like feature gating, a/b testing or simple “Message of the day”.
-
Returns the most recently fetched config.
If there was no config fetched - this method will return an empty instance of
PFConfig.Declaration
Objective-C
+ (nonnull PFConfig *)currentConfig;Swift
class func current() -> PFConfigReturn Value
Current, last fetched instance of PFConfig.
-
Returns the task that encapsulates the most recently fetched config.
If there was no config fetched - this method will return an empty instance of
PFConfig.Declaration
Objective-C
+ (id)getCurrentConfigInBackground;Swift
class func getCurrentConfigInBackground() -> Any!Return Value
Task that encapsulates current, last fetched instance of PFConfig.
-
Gets the
PFConfigasynchronously and sets it as a result of a task.Declaration
Objective-C
+ (id)getConfigInBackground;Swift
class func getInBackground() -> Any!Return Value
The task, that encapsulates the work being done.
-
Gets the
PFConfigasynchronously and executes the given callback block.Declaration
Objective-C
+ (void)getConfigInBackgroundWithBlock:(nullable PFConfigResultBlock)block;Swift
class func inBackground() async throws -> PFConfigParameters
blockThe block to execute. It should have the following argument signature:
^(PFConfig *config, NSError *error).
-
Returns the object associated with a given key.
Declaration
Objective-C
- (nullable id)objectForKey:(nonnull NSString *)key;Swift
func object(forKey key: String) -> Any?Parameters
keyThe key for which to return the corresponding configuration value.
Return Value
The value associated with
key, ornilif there is no such value. -
Returns the object associated with a given key.
This method enables usage of literal syntax on
PFConfig. E.g.NSString *value = config[@"key"];See
objectForKey:
Declaration
Objective-C
- (nullable id)objectForKeyedSubscript:(nonnull NSString *)keyedSubscript;Swift
subscript(keyedSubscript: String) -> Any? { get }Parameters
keyedSubscriptThe keyed subscript for which to return the corresponding configuration value.
Return Value
The value associated with
key, ornilif there is no such value.
-
Gets the
PFConfigobject synchronously from the server.Declaration
Objective-C
+ (nullable PFConfig *)getConfig;Return Value
Instance of
PFConfigif the operation succeeded, otherwisenil. -
Gets the
PFConfigobject synchronously from the server and sets an error if it occurs.Declaration
Objective-C
+ (nullable PFConfig *)getConfig:(NSError *_Nullable *_Nullable)error;Swift
class func getConfig() throws -> PFConfigParameters
errorPointer to an
NSErrorthat will be set if necessary.Return Value
Instance of PFConfig if the operation succeeded, otherwise
nil.
View on GitHub
Install in Dash