> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upgrading InstantSearch iOS

> Upgrade your InstantSearch iOS version

<div className="not-prose algolia-flavor-switcher">
  <div className="afs-dropdown">
    <div className="afs-trigger" role="button" tabIndex="0" aria-haspopup="listbox">
      <span className="afs-current">iOS</span>

      <svg className="afs-chevron lucide lucide-chevron-down" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
        <path d="m6 9 6 6 6-6" />
      </svg>
    </div>

    <ul className="afs-menu" role="listbox">
      <li role="option" aria-selected="false"><a className="afs-option" href="/doc/guides/building-search-ui/upgrade-guides/js"><span className="afs-option-name">JavaScript</span><span className="afs-option-lib">InstantSearch.js</span></a></li>
      <li role="option" aria-selected="false"><a className="afs-option" href="/doc/guides/building-search-ui/upgrade-guides/react"><span className="afs-option-name">React</span><span className="afs-option-lib">React InstantSearch</span></a></li>
      <li role="option" aria-selected="false"><a className="afs-option" href="/doc/guides/building-search-ui/upgrade-guides/vue"><span className="afs-option-name">Vue</span><span className="afs-option-lib">Vue InstantSearch</span></a></li>
      <li role="option" aria-selected="true"><a className="afs-option is-current" href="/doc/guides/building-search-ui/upgrade-guides/ios"><span className="afs-option-name">iOS</span><span className="afs-option-lib">InstantSearch iOS</span></a></li>
      <li role="option" aria-selected="false"><a className="afs-option" href="/doc/guides/building-search-ui/upgrade-guides/android"><span className="afs-option-name">Android</span><span className="afs-option-lib">InstantSearch Android</span></a></li>
    </ul>
  </div>
</div>

<Info>
  Starting May 1, 2024,
  Apple requires all iOS apps to include a privacy manifest.
  For more information, see [Privacy manifest](/doc/guides/building-search-ui/resources/privacy-manifest/ios/).
</Info>

## Upgrade to InstantSearch iOS v8

InstantSearch iOS v8 migrates the underlying Algolia client from v8 to the [Algolia Swift API Client v9](https://github.com/algolia/algoliasearch-client-swift).
This introduces several breaking changes.

### Update dependencies

<Tabs>
  <Tab title="Swift Package Manager">
    Update your `Package.swift` dependency:

    ```swift Swift icon=code theme={"system"}
    .package(url: "https://github.com/algolia/instantsearch-ios", from: "8.0.0")
    ```
  </Tab>

  <Tab title="CocoaPods">
    Update your `Podfile`:

    ```ruby Podfile theme={"system"}
    pod("InstantSearch", "~> 8.0")
    ```

    Run `pod update`.
  </Tab>
</Tabs>

### Handle throwing initializers

Searcher convenience initializers that accept `appID` and `apiKey` strings now throw errors because `SearchClient(appID:apiKey:)` throws in the Algolia Swift API Client v9. This applies to `HitsSearcher`, `FacetSearcher`, `MultiIndexSearcher`, and `MultiSearcher`.

<CodeGroup>
  ```swift Before v7 theme={"system"}
  let searcher = HitsSearcher(appID: "ALGOLIA_APPLICATION_ID",
                              apiKey: "ALGOLIA_API_KEY",
                              indexName: "INDEX_NAME")
  ```

  ```swift Before v8 theme={"system"}
  let searcher = try HitsSearcher(appID: "ALGOLIA_APPLICATION_ID",
                                  apiKey: "ALGOLIA_API_KEY",
                                  indexName: "INDEX_NAME")
  ```
</CodeGroup>

Alternatively, create the `SearchClient` yourself and use the non-throwing initializer:

```swift Swift icon=code theme={"system"}
let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID",
                              apiKey: "ALGOLIA_API_KEY")
let searcher = HitsSearcher(client: client, indexName: "INDEX_NAME")
```

### Remove answers and places usage

InstantSearch iOS removed `AnswersSearcher` and `PlacesSearcher` (including their services and connectors) because Algolia Answers and Algolia Places are no longer available.
Remove code that references these types.

* `AnswersSearcher`, `AlgoliaAnswersSearchService`, `AnswersSearcher+FilterState`
* `PlacesSearcher`, `AlgoliaPlacesSearchService`, `Hit+Place`, `HitsConnector+GeoSearch`
* `IndexSegmentInteractor+AnswersSearcher`

### Adapt to new query types

The query parameter type has changed from the v8 client's `Query` to `SearchSearchParamsObject` from the v9 client.
If you set query parameters directly,
update your code to use `SearchSearchParamsObject`.

### Use the local `Hit` type

The `Hit` type is now defined locally in InstantSearchCore rather than being re-exported from the API client.
If you reference `Hit` from the Algolia client module, update your imports.
A SearchHit type alias for `Hit<[String: AnyCodable]>` is available for convenience.

## Update event tracking

**Starting from v7.26.2,
InstantSearch makes it easier to send view events using the [`isAutoSendingHitsViewEvents`](/doc/api-reference/widgets/instantsearch/ios#param-is-auto-sending-hits-view-events) option** on [`HitsSearcher`](/doc/api-reference/widgets/instantsearch/ios#hitssearcher):

```swift Swift icon=code theme={"system"}
let searcher = HitsSearcher(appId: "ALGOLIA_APPLICATION_ID",
                            apiKey: "ALGOLIA_SEARCH_API_KEY",
                            index: "indexName",
                            isAutoSendingHitsViewEvents: true)
```

<Warning>
  From v7.24.0 to v7.26.1, view events were sent automatically.
  Ensure you're using the latest version of InstantSearch to send the required events.
</Warning>

## Upgrade to InstantSearch iOS v5

InstantSearch v5 introduces a new architecture and new widgets,
which brings several breaking changes from the previous versions:

* **No `InstantSearch` component** to automatically connecting widgets.
  You are now in control of the `Searcher` and responsible for connecting and disconnecting it from widgets and other components.

* Widgets are now **built around an `Interactor`**,
  which holds their data and business logic.

  In previous versions, widgets were iOS `UIViews`.
  Now the core of a widget is its interactor.
  The widget's UI is behind an interface to minimize coupling.

To learn more, see:

* [What is InstantSearch iOS](/doc/guides/building-search-ui/what-is-instantsearch/ios)
* [Get started](/doc/guides/building-search-ui/getting-started/ios)

<Info>
  The InstantSearch iOS v3 documentation is available on the [legacy docs page](https://algolia.com/old-docs/deprecated/instantsearch/ios/v3/api-ref/api-ref/).
</Info>
