Getting Started

Integration

The minimum iOS version is iOS 12.

The latest SDK version can be found here

The library can be integrated to iOS projects using diffrect ways:

1. Swift Package Manager (SPM)

  • Go to your project → Package Dependencies tab.

  • Click the + sign to add a new package.

  • Add the following SPM dependency URL:

    https://github.com/Teavaro/FunnelConnectSDK_iOS
    

2. CocoaPods

  • If it is the first time to add a CocoaPod to your project, then you should follow this official tutorial to install CocoaPods.

  • Add this pod to your project’s podfile pod 'FunnelConnect', or you can specify an explicit version pod 'FunnelConnect', 'LATEST_VERSION'

  • Install the pod:

    cd {PATH_TO_YOUR_PROJECT}
    pod install
    

If for some reason you got an error saying that the latest version is not found, please try to update the SDK pod using this command pod update FunnelConnect Please make sure that you have the latest stable version.

3. Binary framework

  • Head to this Repo.
  • Download this file FunnelConnect.xcframework.
  • Drag and drop it to your project.
  • Make sure you always have the latest stable update of the framework.

Please make sure that you have the latest stable version.

Initializing the library

Basic initializing

Once integrated into your app, you can simply call the SDK initializer in the main class of your application.

This is how you do it:

let plistFile = Bundle.main.path(forResource: "FunnelConnectConfigs", ofType: "plist")!
FunnelConnectSDK.shared.initialize(sdkToken: "test123", plistFilePath: plistFile)

The config file and the token will be sent to you once you register your app.

Initializing with custom options

FCOptions() is an optional initialization parameter, so you can initialize the SDK without passing it, but in case there are options that you want to specifically enable or disable, this can be done by passing a custom options object to the initializer. Currently, enable debugging is the only available option, but there will be more in the future.

let options = FCOptions(enableLogging: true)  
let plistFile = Bundle.main.path(forResource: "FunnelConnectConfigs", ofType: "plist")!
FunnelConnectSDK.shared.initialize(sdkToken: "test123", plistFilePath: plistFile, options:  options)

Check if the SDK is initialized

At some point, you will want to check if the SDK is initialized before doing anything else.

Boolean check
FunnelConnectSDK.shared.isInitialized()
didInitializeWithResult
FunnelConnectSDK.shared.didInitializeWithResult { [weak self] in
        // Success Action
} failure: { [weak self] error in
        // Failure Actio
}

you would need to do this if you want to do something with the SDK very early (for example in the splash screen) and you want to make sure that the SDK is initialized before doing anything with the SDK, however if you will use the SDK services in a class that will require going through multiple steps, such as the cart page in an e-commerce app, most probably you won’t need to use these function because the SDK will be already initialized by the time of reaching to that page or class, so it is your call to decide when to use that check and when not to.

Clear cache

Cached data and cookies can be cleared easily using the following functions.

try? FunnelConnectSDK.shared.clearData()
try? FunnelConnectSDK.shared.clearCookies()

Basic usage

Once the SDK is initialized, all the services functions can be called by calling FunnelConnectSDK. to access the SDK functions.

Support and bug reporting

If you have any suggestions or you want to report a bug or ask a question, please create a new issue in this repository.

You can also check if there is a similar issue to yours that has been solved before.