轻量级和更新的解决方案!
Google Api 助手(自动完成)
var input = GInput()
input.keyword = "San francisco"
GoogleApi.shared.callApi(input: input) { (response) in
if let results = response.data as? [GApiResponse.Autocomplete], response.isValidFor(.autocomplete) {
//Enjoy the Autocomplete Api
} else { print(response.error ?? "ERROR") }
}
Google Api 助手(地点信息)
var input = GInput()
input.keyword = "chijucwgqk6mqtkrukvhclvqfie"
GoogleApi.shared.callApi(.placeInformation,input: input) { (response) in
if let place = response.data as? GApiResponse.PlaceInfo, response.isValidFor(.placeInformation) {
//Enjoy the Place Api
} else { print(response.error ?? "ERROR") }
}
Google Api Helper(更多)
https://github.com/tryWabbit/Google-Api-Helper