AtlasKit
一个用于快速集成位置搜索到您应用的 Swift 库。
使用 Cocoapods 安装
pod 'AtlasKit'
快速开始
首先使用数据源创建一个 AtlasKit
对象:Apple、Google 或 GetAddress.io。一个使用 Apple 数据源的 AtlasKit 实例将尝试使用 Apple Maps 获取位置,而一个使用 Google 或 GetAddress 数据源的实例在初始化时将需要一个 API 密钥并尝试使用相应的 API(Google Places 或 GetAddress)。
一旦设置了实例,您就可以开始进行搜索请求,您可以使用或不需要延迟(用于与文本字段一起搜索)。
atlasKit.performSearchWithDelay(term, delay: 0.5) { predictions, error in
...
}
atlasKit.performSearch(term) { { predictions, error in
...
}
您还可以使用以下方式取消所有挂起的搜索:
atlasKit.cancelSearch()
搜索预测是 AtlasKitPlace
对象的实例,它包括;街道地址、城市、邮政编码、州、国家、位置(坐标)。请注意,这些值都是可选的,并不总是可用。
警告 - 此库仅打算用于英国位置,因此邮政编码值在英国以外不支持。