Last modified February 12, 2019 by Shelly Wolfe

What is a Swrve resource?

In Swrve, a resource is a way to serve content to users that is configurable in the Swrve dashboard. Each resource contains attributes that the Swrve SDK can access and use to customize different aspects of the app.

In the example below, the resource name is called “Download Button” and holds the attributes of what the button will look and behave like on the client. The attributes of the resource consist of key/value pairs (as Strings):

Resource example download button

When a user launches the app, the SDK downloads all resources onto the client and stores them in the Swrve Resource Manager.

In the app code, you can access the resource’s attributes. The example below illustrates how to access a Resources attribute and use it in your app. Notice you also provide a default value in case the resource has not yet been downloaded to the device.

Example

Resource example button text is Download

iOS

Android

Unity

Using the above code, you can now change the the download button text without needing to update the app code. Simply edit the Resource attributes in the Swrve dashboard and the changes will be reflected in the app. For example, change the button text from “Download” to “Download Now!”

Resource example button text Download Now

Resource limits

You may register a number of resources or configuration items that are specific to your app, which you can then use as a basis for A/B testing. Limits apply to the total number of resources that you can register for an app.

  • Maximum number of resources per app = 1000
  • Maximum number of attributes for any resource = 100
  • Maximum resource UID, name and class length = 191
  • Maximum resource attribute key length = 40
  • Maximum resource attribute value length = 255

Next steps