Oct 21, 2024
Upgrade the Swift API clients to v9
The latest major version of the algoliasearch-client-swift package is v9.
This page lists the breaking changes since the last release, v8.
Method changes overview
The following table has links for all methods and their replacements
Search API client
Recommend API client
| v8 (legacy) | v9 (latest) | |
|---|---|---|
client.getFrequentlyBoughtTogether |
→ | client.getRecommendations |
client.getRecommendations |
→ | client.getRecommendations |
client.getRelatedProducts |
→ | client.getRecommendations |
Removal of InitIndex
All methods are methods of a client instance.
The initIndex method of the SearchClient class has been removed.
Instead, all methods require a indexName parameter.
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
// v8
let client = SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY")
let index = client.index(withName: "ALGOLIA_INDEX_NAME")
index.search(query: "QUERY")
// v9
let client = try SearchClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY")
try await client.searchSingleIndex(
indexName: "ALGOLIA_INDEX_NAME",
searchParams: SearchSearchParams.searchSearchParamsObject(
SearchSearchParamsObject(query: "QUERY")
)
)
Wait for tasks
The Wait method has been removed.
Instead, use one of the following helpers:
waitForTaskto wait until indexing operations are donewaitForAppTaskto wait for application-level taskswaitForApiKeyto wait for API key operations
Copy or moving indices, settings, synonyms, or rules
Use the operationIndex method,
which replaces the following methods:
copyIndexmoveIndexcopyRulescopySynonymscopySettings
Did you find this page helpful?