MFData Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | MFData.h MFData.m |
Overview
The MFData class is a local representation of data persisted to the Mesosfer cloud. This is the main class that is used to interact with objects in your app.
bucket
Specifies the bucket name of MFData.
@property (strong, nonatomic, readonly, nullable) NSString *bucketDeclared In
MFData.h
data
Specifies the custom NSDictionary data of MFData.
@property (strong, nonatomic, readonly, nullable) NSDictionary *dataDeclared In
MFData.h
schema
Specifies the MFDataSchema of MFData object.
@property (strong, nonatomic, readonly, nullable) MFDataSchema *schemaDiscussion
This field will be assigned by fetching current object that exists or by saving new user to Mesosfer cloud.
Declared In
MFData.h
+ dataWithBucket:NS_SWIFT_NAME:
Creates a new MFData with a bucket name.
+ (nonnull instancetype)dataWithBucket:(nonnull NSString *)bucket NS_SWIFT_NAMEParameters
bucket |
A bucket name can be any alphanumeric string that begins with a letter. It represents an object in your app, like a ‘User’ or a ‘Document’. |
|---|
Return Value
the object that is instantiated with the given bucket name.
Declared In
MFData.h
+ dataWithSchema:NS_SWIFT_NAME:
Creates a new MFData with a MFDataSchema object.
+ (nonnull instancetype)dataWithSchema:(nonnull MFDataSchema *)schema NS_SWIFT_NAMEParameters
schema |
A |
|---|
Return Value
the object that is instantiated with the given MFDataSchema object.
Declared In
MFData.h
+ dataWithObjectId:NS_SWIFT_NAME:
Creates a reference to an existing MFData for use in creating associations between MFDatas.
+ (nonnull instancetype)dataWithObjectId:(nonnull NSString *)objectId NS_SWIFT_NAMEParameters
objectId |
The object id for the referenced |
|---|
Return Value
A MFData instance without data.
Discussion
Warning: You need to call MFData.fetchAsyncWithBlock: to fetch object from Mesosfer cloud.
Declared In
MFData.h
+ queryWithSchema:
Creates a new MFQuery instance for querying MFData objects using MFDataSchema object.
+ (nonnull MFQuery *)queryWithSchema:(nonnull MFDataSchema *)dataSchemaParameters
dataSchema |
The |
|---|
Return Value
A new MFQuery instance.
Declared In
MFData.h
– dictionary
Gets all key and value pair of MFData object in a dictionary.
- (nullable NSDictionary *)dictionaryReturn Value
The dictionary of all key and value pair object.
Declared In
MFData.h
– objectForKey:
Returns the value associated with a given key.
- (nullable id)objectForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
See Also
Declared In
MFData.h
– objectForKeyedSubscript:
Returns the value associated with a given key.
- (nullable id)objectForKeyedSubscript:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Discussion
This method enables usage of literal syntax on MFUser. E.g. NSString *value = user[@"key"];
See Also
Declared In
MFData.h
– stringForKey:
Returns the NSString value associated with a given key.
- (nullable NSString *)stringForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFData.h
– numberForKey:
Returns the NSNumber value associated with a given key.
- (nullable NSNumber *)numberForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFData.h
– doubleForKey:
Returns the double value associated with a given key if it exists and is a double or can be coerced to a double, or NAN otherwise.
- (double)doubleForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFData.h
– integerForKey:
Returns the int value associated with a given key if it exists and is an int or can be coerced to an int, or 0 otherwise.
- (int)integerForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFData.h
– booleanForKey:
Returns the BOOL value associated with a given key.
- (BOOL)booleanForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFData.h
– dateForKey:
Returns the NSDate value associated with a given key if it exists and is a NSDate or can be coerced to a NSDate, or nil otherwise.
- (nullable NSDate *)dateForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFData.h
– dictionaryForKey:
Returns the NSDictionary value associated with a given key.
- (nullable NSDictionary *)dictionaryForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFData.h
– arrayForKey:
Returns the NSArray value associated with a given key.
- (nullable NSArray *)arrayForKey:(nonnull NSString *)keyParameters
key |
The key for which to return the corresponding value. |
|---|
Declared In
MFData.h
– removeObjectForKey:
Unsets a key on the object.
- (void)removeObjectForKey:(nonnull NSString *)keyParameters
key |
The key. |
|---|
Declared In
MFData.h
– setObject:forKey:
Sets the object associated with a given key.
- (void)setObject:(nonnull id)object forKey:(nonnull NSString *)keyParameters
object |
The object for |
|---|---|
key |
The key for |
See Also
Declared In
MFData.h
– setObject:forKeyedSubscript:
Returns the value associated with a given key.
- (void)setObject:(nonnull id)object forKeyedSubscript:(nonnull NSString *)keyParameters
object |
The object for |
|---|---|
key |
The key for |
Discussion
This method enables usage of literal syntax on MFUser. E.g. user[@"key"] = @"value";
See Also
Declared In
MFData.h
– incrementKey:
Increments the given key by 1.
- (nonnull instancetype)incrementKey:(nonnull NSString *)keyParameters
key |
The key. |
|---|
Return Value
The same instance of MFData as the receiver. This allows method chaining.
Declared In
MFData.h
– incrementKey:byAmount:
Increments the given key by a number.
- (nonnull instancetype)incrementKey:(nonnull NSString *)key byAmount:(nonnull NSNumber *)amountParameters
key |
The key. |
|---|---|
amount |
The amount to increment. |
Return Value
The same instance of MFData as the receiver. This allows method chaining.
Declared In
MFData.h
– fetchAsyncWithBlock:
Fetch the current MFData data from Mesosfer cloud asynchronously and executes the given callback block.
- (void)fetchAsyncWithBlock:(nullable MFDataResultBlock)blockParameters
block |
The block to execute. It shoud have the following argument signature: |
|---|
Declared In
MFData.h
– saveAsyncWithBlock:
Saves the MFData asynchronously and executes the given callback block.
- (void)saveAsyncWithBlock:(nullable MFBooleanResultBlock)blockParameters
block |
The block to execute. It should have the following argument signature: |
|---|
Declared In
MFData.h
– deleteAsyncWithBlock:
Delete the MFData object in Mesosfer cloud asynchronously and executes the given callback block.
- (void)deleteAsyncWithBlock:(nullable MFBooleanResultBlock)blockParameters
block |
The block to execute. It should have the following argument signature: |
|---|
Declared In
MFData.h