YAPlacePicker
示例
要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install
。同时您需要在 ViewController 中提供 APIKEY。
要求
您需要 Google Maps 和 Google Places 的 APIKEY。如果您没有,请在这里查看:https://developers.google.com/maps/documentation/ios-sdk/get-api-key
如何使用?
将以下内容添加到 Info.plist 中
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is required to see places close to you</string>
将以下代码添加到您希望打开 YAPlacePicker 的位置
//baseVC - UIViewController from which you want to open YAPlacePicker
YAPlacePickerBuilder(baseVC: self, gmsApiKey: ".........", completion: { place in
print(place)
}).show()
可用的自定义设置(可选)
YAPlacePickerBuilder(baseVC: self, gmsApiKey: ".........", completion: { place in
print(place)
})
.searchPlaceholder("Please start typing")
.chooseButtonTitle("Choose")
.chooseButtonColor(UIColor.red)
.show()
安装
YAPlacePicker 通过 CocoaPods 提供。要安装它,只需将以下行添加到 Podfile
pod 'YAPlacePicker'
作者
尼基塔·胡德罗日科夫,[email protected]
许可证
YAPlacePicker可在MIT许可证下使用。更多信息请参阅LICENSE文件。
贡献
请随时提供改进意见。