SDK Guide
For Mobile Apps/Games

iOS

9min

This guide is for anyone who wishes to integrate the Enefits Mobile SDK into an iOS native app. Before continuing, we highly recommend reviewing the General Usage guide to familiarize yourself with general SDK workflow concepts before continuing.

You will need to generate an API key with your Enefits account before continuing with integration.

To obtain an API Key, simply register at http://enefits.co, go to Developer in the account menu in the top right section. From there, generate an API Key and save this for all API requests as defined below.

We only show this once so if you lose this API Key, you’ll have to re-generate from the Developer section.

Run The Demo

To run a live demo, visit https://bajaar.beanstalkapp.com/enefits-mobile-sdk/browse/git/ios and provide your own API key where requested.

Download The SDK

The Enefits iOS SDK can be downloaded from https://bajaar.beanstalkapp.com/enefits-mobile-sdk/browse/git/ios

Installation

  • Add the EnefitsSDK.xcFramework to your project
  • Go to Targets -> General -> Frameworks change the Embed to Embed & Sign

SDK Setup

Initialize The SDK

Import the SDK in the required controllers -> "import EnefitsSDK"

ObjectiveC


Connect Wallet

Display a button or call-to-action (for example: Connect Wallet) which when pressed or clicked will prompt the user to connect a wallet.After the user selects a wallet and initiates a session, the returned address will be available to the Enefits SDK to check NFTs and any offers the user is eligible for.

  • This function will open a view with a list of supported providers
  • Enefits SDK will fire the callback after successfully connecting with a blockchain account.
ObjectiveC


/* Get callback after wallet connected */

ObjectiveC


Get All Enefits Offers

  • This method will return all Offers that the user is eligible for based on the address they provided when they connected their wallet.
  • Based on the response from this method and the existence of a specific id value that the Mobile App is looking for, your app logic will handle accordingly.
ObjectiveC


Helper Functions

Use the functions provided below to create a tighter integration with the Enefits SDK and manage user connectivity states.

ObjectiveC

ObjectiveC

ObjectiveC

ObjectiveC

ObjectiveC