Getting started
Stay organized with collections
Save and categorize content based on your preferences.
This page describes how to get set up with the iOS SDK. If you haven't
completed the prerequisites, complete
them first.
Dependency
Swift Package Manager
In Xcode, install the Google-SearchInApps-SDK Swift Package by navigating to File > Add Packages....
In the prompt that appears, search for the Google-SearchInApps-SDK Swift Package GitHub repository:
https://github.com/google/search-in-apps.git
- 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.
CocoaPods
Import the Google-SearchInApps-SDK into an iOS project using
CocoaPods. 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 for info on
how to create and use Podfiles.
Update your Info.plist
Update your app's Info.plist
file to add two keys:
- A
GSAAPIKey
key with a string value of your SDK api key (see above).
- 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
Objective-C
ContextualSearchRuntime
ContextualSearchRuntime *searchRuntime = [[ContextualSearchRuntime alloc] init];
Next: Search featuresarrow_forward
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-05 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-11-05 UTC."],[[["This guide explains how to integrate the iOS SDK for Google Search in Apps, covering setup, dependency management, and initialization."],["Before starting, ensure you have fulfilled the prerequisites mentioned in the linked documentation."],["You can add the SDK to your project using either Swift Package Manager or CocoaPods, with instructions provided for both methods."],["Remember to update your app's `Info.plist` file with your API key and client identifier for the SDK to function correctly."],["Finally, initialize the `ContextualSearchRuntime` to begin utilizing the search functionalities."]]],["To set up the iOS SDK, first install the Google-SearchInApps-SDK via Swift Package Manager or CocoaPods. For Swift Package Manager, add the package via Xcode using the provided GitHub repository URL. For CocoaPods, add `pod 'Google-SearchInApps-SDK'` to your Podfile and run `pod install --repo-update`. Then, update your app's `Info.plist` by adding `GSAAPIKey` and `GSAClientIdentifier`. Finally, initialize a `ContextualSearchRuntime` instance in either Swift or Objective-C.\n"]]