# Installing the Freshpaint iOS SDK

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

```ruby
pod 'Freshpaint', '0.4.2'
```

Then run:

```bash
pod install --repo-update
```

To import the Freshpaint SDK use:

{% tabs %}
{% tab title="Swift" %}

```swift
import FreshpaintSDK
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
#import <FreshpaintSDK/FPAnalytics.h>
```

{% endtab %}
{% endtabs %}

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

{% tabs %}
{% tab title="Swift" %}

```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)
    ...
}
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    ...
    FPAnalyticsConfiguration *configuration = [FPAnalyticsConfiguration configurationWithWriteKey:@"<your environment id>"];
    configuration.trackApplicationLifecycleEvents = YES;
    configuration.recordScreenViews = YES;
    [FPAnalytics setupWithConfiguration:configuration];
    ...
}
```

{% endtab %}
{% endtabs %}

You can get your environment id by going to the [Freshpaint sources page](https://app.freshpaint.io/sources).

## Verifying Your Instrumentation

To verify your Freshpaint installation, navigate to the Freshpaint [Live View](https://app.freshpaint.io/events/liveview). After opening your app, you should see an `Application Opened` event show up in Live View:

![](https://1666823438-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MA7aDqsXMFbUsWVqonF%2F-MQT2P7kPVThjXx36U70%2F-MQTFujhym67mQlXhxP9%2Fimage.png?alt=media\&token=d5c86e55-bff8-4e23-bd44-c89184142400)

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