14min

iOS

This walkthrough shows you how to add Unflow to your iOS application and add your first carousel

What is Unflow?

Unflow provides a collaborative editor where marketing teams at mobile apps can design and deliver engaging in-app content to their users instantly. With our SDK, there is no need to involve engineering or wait on app store release cycles to deliver content. You can read more about how Unflow fits into your app or you can register to start building.



1. Adding the package

Unflow for iOS can be installed either via CocoaPods or Swift Package Manager.

Swift Package Manager
CocoaPods

You can add Unflow to you app using Swift Package Manager – an easy way to add Packages (third-party dependencies) to your Xcode project. In Xcode, select your project in the sidebar, head to "Package Dependencies" and tap the plus. Enter the following URL in the search bar.



https://github.com/unflowhq/unflow-ios-sdk Select unflow-ios-sdk in the list that shows up, then set the version rule to Up to next major – the latest version of Unflow can be found in the releases section of our iOS SDK repo on Github. It should look something like this.

An image of Xcode showing the Swift Package Manager entry form.
An image of Xcode showing the Swift Package Manager entry form.



After selecting Add Package, choose the target you want to use it in. You'll most likely want to use Unflow in your main app target.

The library should have been added to the Swift Package Dependencies section and you should be able to import it now.



2. Configuration

Once you've installed the Unflow SDK for your app, it's time to initialize and configure it.

You should only configure Unflow once, usually early in your application lifecycle. After configuration, the same instance is used throughout your app by accessing the shared singleton in the SDK.

App Delegate lifecycle
SwiftUI App Lifecycle
|

Only use your public API key to configure Unflow

You can get your public API key from the app settings on the dashboard.



Enabling Logging

Be sure to enable and view debug logs before filing a ticket with Unflow Support.

As detailed in the sample code above, debug logs can be enabled or disabled by setting the enableLogging property when configuring Unflow.

Debug logs will provide detailed log output in XCode for what is going on behind the scenes and should be the first thing you check if your app is behaving unexpectedly, and also to confirm there aren't any unhandled warnings or errors.





3. Displaying Content

Unflow supports both SwiftUI and UIKit apps. Please find instructions to include the Opener UI for your app below.

Swift UI
Storyboard
UIKit

By default we'll render our banner view. This will be scrollable if multiple Screens are live, but full width if only a single Screen exists.

Swift
|



Updated 14 Apr 2022
Did this page help?
Yes
No