Managing Soups

SmartStore provides utility functionality that lets you retrieve soup metadata and perform other soup-level operations. This functionality is available for hybrid, React Native, Android native, and iOS native apps.

To use soup management APIs in a native iOS app, import SmartStore/SFSmartStore.h. You call soup management methods on a shared instance of the SmartStore object. Obtain the shared instance by using one of the following SFSmartStore class methods.### Using the SmartStore instance for the current user:

Swift

Example:

Objective-C

Swift

Example:

Objective-C

Example:

To use soup management APIs in a native Android app, you call methods on the shared SmartStore instance:

Each soup management function in JavaScript takes two callback functions: a success callback that returns the requested data, and an error callback. Success callbacks vary according to the soup management functions that use them. Error callbacks take a single argument, which contains an error description string. For example, you can define an error callback function as follows:

To call a soup management function in JavaScript, first invoke the Cordova plug-in to initialize the SmartStore object. You then use the SmartStore object to call the soup management function. The following example defines named callback functions discretely, but you can also define them inline and anonymously.

See Also