Installing the Freshpaint iOS SDK

To install the Freshpaint iOS SDK, add the following to your app's Podfile:

pod 'Freshpaint', :git => 'https://github.com/freshpaint-io/freshpaint-ios.git', :tag => '0.2.0'

Then run:

pod install --repo-update

To import the Freshpaint SDK use:

Swift
Objective-C
Swift
import FreshpaintSDK
Objective-C
#import <FreshpaintSDK/FPAnalytics.h>

Then to initialize the SDK, add the following code to your application delegate's didFinishLaunchingWithOptions:

Swift
Objective-C
Swift
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions
launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
let config = FreshpaintConfiguration(writeKey: "<your environment id>");
config.trackApplicationLifecycleEvents = true
config.recordScreenViews = true
Freshpaint.setup(with: config)
...
}
Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
...
FPAnalyticsConfiguration *configuration = [FPAnalyticsConfiguration configurationWithWriteKey:@"<your environment id>"];
configuration.trackApplicationLifecycleEvents = YES;
configuration.recordScreenViews = YES;
[FPAnalytics setupWithConfiguration:configuration];
...
}

You can get your environment id by going to the Freshpaint sources page.

Verifying Your Instrumentation

To verify your Freshpaint installation, navigate to the Freshpaint Live View. After opening your app, you should see an Application Opened event show up in Live View:

Note, the Freshpaint SDK batches events, so it can take a minute for the event to show up.