InstantSearch iOS
如果您想使用 Algolia 为 iOS 构建搜索界面,那么您应该查看基于这个库构建并提供构建搜索体验 UI 模块的 InstantSearch iOS。否则,请继续阅读。
InstantSearch Core for Swift
这是基于Algolia Swift API Client构建的Swift版InstantSearch Core库,它使用了Algolia的搜索API。它在macOS、iOS、tvOS和watchOS上运行。
您可以在Algolia文档网站上找到最新版本的用户文档。
安装
如果您使用的是低于 4.2 的 Swift 版本,则必须使用 InstantSearch Core 3.3 版本。这个版本已经过时,不建议使用。
CocoaPods
CocoaPods 是一个为 Cocoa 项目管理的依赖关系管理器。
要安装 InstantSearch,只需将以下行添加到您的 Podfile 中
Swift 5.0+
pod 'InstantSearchCore', '~> 7.0'
Swift 4.2+
pod 'InstantSearchCore', '~> 5.0'
Swift 4.1
pod 'InstantSearchcore', '~> 3.3'
然后,运行以下命令
$ pod update
Carthage
Carthage 是一个简单的、去中心化的 Cocoa 依赖管理器。
要安装 InstantSearch,只需将以下行添加到您的 Cartfile 中
Swift 5.0+
github "algolia/instantsearch-core-swift" ~> 7.0
然后,从项目目录中运行以下命令
carthage update
./Carthage/Checkouts/instantsearch-core-swift/carthage-prebuild
carthage build
Swift 4.2+
github "algolia/instantsearch-core-swift" ~> 5.0
Swift 4.1
github "algolia/instantsearch-core-swift" ~> 3.3
Swift包管理器
Swift包管理器(SwiftPM)是一款用于管理Swift代码以及C家族依赖项的分布的工具。从Xcode 11开始,SwiftPM被原生集成到Xcode中。
从6.4.0版本开始,InstantSearch Core支持SwiftPM。要使用SwiftPM,您应该使用Xcode 11打开项目。点击文件
-> Swift包
-> 添加包依赖
,输入InstantSearch Core仓库的URL。选择包后,您可以选择依赖类型(标记版本、分支或提交)。然后Xcode将为您设置所有内容。
如果您是框架作者,并且将InstantSearch Core用作依赖项,请更新您的Package.swift
文件。
let package = Package(
// ...
dependencies: [
.package(name: "InstantSearchCore", url: "https://github.com/algolia/instantsearch-core-swift", from: "7.0")
],
// ...
)
许可协议
InstantSearch Core iOS 是Apache 2.0 许可协议。