Documentation • Community Forum • Stack Overflow • Report a bug • Support
## ✨ Features - Pure cross-platform Swift client - Typed requests and responses - Widespread use of `Result` type - Uses the power of `Codable` protocol for easy integration of your domain models - Thread-safe clients - Detailed logging - Injectable HTTP client ## 💡 Getting Started ### Swift Package Manager The Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. Since the release of Swift 5 and Xcode 11, SPM is compatible with the iOS, macOS and tvOS build systems for creating apps. To use SwiftPM, you should use Xcode 11 to open your project. Click `File` -> `Swift Packages` -> `Add Package Dependency`, enter [the client repo's URL](https://github.com/algolia/algoliasearch-client-swift). If you're a framework author and use Swift API Client as a dependency, update your `Package.swift` file: ```swift let package = Package( // 9.0.0 ..< 10.0.0 dependencies: [ .package(url: "https://github.com/algolia/algoliasearch-client-swift", from: "9.0.0") ], // ... ) ``` ### Cocoapods [CocoaPods](https://cocoapods.org/) is a dependency manager for Cocoa projects. To install Algolia Swift Client, simply add the following line to your Podfile: ```ruby pod 'AlgoliaSearchClient', '~> 9.0.0' # pod 'InstantSearchClient', '~> 7.0' // Swift 5.9 NOT YET RELEASED ``` Then, run the following command: ```bash $ pod update ``` ### Carthage [Carthage](https://github.com/Carthage/Carthage) is a simple, decentralized dependency manager for Cocoa. - To install InstantSearch, simply add the following line to your Cartfile: ```ruby github "algolia/algoliasearch-client-swift" ~> 9.0.0 ``` - Launch the following commands from the project directory (for v.8.0+) ```shell carthage update ./Carthage/Checkouts/algoliasearch-client-swift/carthage-prebuild carthage build ``` If this is your first time using Carthage in the project, you'll need to go through some additional steps as explained [over at Carthage](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application). You can now import the Algolia API client in your project and play with it. > Import the Core package and the required client package to your source code files: ```swift #if canImport(AlgoliaCore) import AlgoliaCore #endif import AlgoliaSearch let client = try SearchClient(appID: "YOUR_APP_ID", apiKey: "YOUR_API_KEY") // Add a new record to your Algolia index let response = try await client.saveObject( indexName: "