This page describes how to get set up with the iOS SDK. If you haven't
completed the [prerequisites](https://developers.google.com/search-in-apps/ios/prerequisites), complete
them first.

## Dependency

### Swift Package Manager

1. In Xcode, install the Google-SearchInApps-SDK Swift Package by navigating to File \> Add Packages....

2. In the prompt that appears, search for the Google-SearchInApps-SDK Swift Package GitHub repository:

    https://github.com/google/search-in-apps.git

1. Select the version of the Google-SearchInApps-SDK Swift Package you want to use. For new projects, we recommend using the **Up to Next Major Version**

Once you're finished, Xcode will begin resolving your package dependencies and
downloading them in the background. For more details on how to add package
dependencies, see [Apple's article](https://developer.apple.com/documentation/swift_packages/adding_package_dependencies_to_your_app).

### CocoaPods

Import the Google-SearchInApps-SDK into an iOS project using
[CocoaPods](https://guides.cocoapods.org/using/getting-started). Open your
project's Podfile and add this line to your app's target:

    pod 'Google-SearchInApps-SDK'

Then from the command line run:

    pod install --repo-update

If you're new to CocoaPods, see their [official
documentation](https://guides.cocoapods.org/using/using-cocoapods) for info on
how to create and use Podfiles.

## Update your Info.plist

Update your app's `Info.plist` file to add two keys:

1. A `GSAAPIKey` key with a string value of your SDK api key (see above).
2. A `GSAClientIdentifier` key with a string value of your app's client identifier (see above).

Sample `Info.plist`

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>GSAAPIKey</key>
            <string>ABC123...xyz890</string>
            <key>GSAClientIdentifier</key>
            <string>ms-demo-app-sia</string>
            ...
    </dict>
    </plist>

## Init

Create an instance of the
[`ContextualSearchRuntime`](https://developers.google.com/search-in-apps/ios/reference/api/swift_reference/Classes/ContextualSearchRuntime)

### Swift

[`ContextualSearchRuntime`](https://developers.google.com/search-in-apps/ios/reference/api/swift_reference/Classes/ContextualSearchRuntime)

    let contextualSearchRuntime = ContextualSearchRuntime()

### Objective-C

[`ContextualSearchRuntime`](https://developers.google.com/search-in-apps/ios/reference/api/objc_reference/Classes/ContextualSearchRuntime)

    ContextualSearchRuntime *searchRuntime = [[ContextualSearchRuntime alloc] init];

[Next: Search features](https://developers.google.com/search-in-apps/ios/features)