About
This page provides documentation for the AlgoliaSearchClientSwift library. AlgoliaSearchClientSwift is a Swift client for the Algolia Search API that allows you to implement fast and relevant search in your iOS or macOS applications.
Installation
Requirements
- iOS 9.0+ / macOS 10.11+ / watchOS 2.0+
- Xcode 11.0+
- Swift 5+
CocoaPods
To install AlgoliaSearchClientSwift using CocoaPods, add the following line to your Podfile:
// Podfile
pod 'AlgoliaSearchClientSwift'
Then, run the following command:
$ pod install
Carthage
To install AlgoliaSearchClientSwift using Carthage, add the following line to your Cartfile:
// Cartfile
github "algolia/algoliasearch-client-swift"
Then, run the following command:
$ carthage update --platform iOS --no-use-binaries
Swift Package Manager
You can also use Swift Package Manager to include AlgoliaSearchClientSwift as a dependency in your Swift package.
// Package.swift
let package = Package(
// ...
dependencies: [
.package(url: "https://github.com/algolia/algoliasearch-client-swift", from: "8.4.0")
],
// ...
)
Usage
Start by importing the AlgoliaSearchClientSwift module into your Swift file:
import AlgoliaSearchClientSwift
Then, you can create a client instance:
let client = SearchClient(appID: "YOUR_APP_ID", apiKey: "YOUR_API_KEY")
To perform a search, you can call the search function:
let query = Query(query: "search query")
client.search(query) { result in
// Handle search results
}
The search function accepts a Query object that allows you to customize your search parameters, such as filters, sorting, and pagination.
Documentation
For detailed instructions and examples, please refer to the official documentation of AlgoliaSearchClientSwift:
https://github.com/algolia/algoliasearch-client-swift
Contributing
If you would like to contribute to the development of AlgoliaSearchClientSwift, please follow the guidelines outlined in the CONTRIBUTING.md file on the GitHub repository.
https://github.com/algolia/algoliasearch-client-swift/blob/master/CONTRIBUTING.md