Digvijaysinh Gida
Digvijaysinh Gida

Reputation: 411

How to call google map api using swift 4?

My issue is a, I need only restaurant, bar using google API.

If you need code i'm send you.

this is my base url:- "https://maps.googleapis.com/maps/api/place/"

nearbyURLFragment :- let nearbyURLFragment = "nearbysearch/json?key=%@&location=%f,%f&rankby=distance&type=restaurant,bar"

a single type of proper working.

but here is I'm not getting a proper result.

Upvotes: 1

Views: 184

Answers (1)

Harry J
Harry J

Reputation: 1966

Quoting the Google API Docs,

Restricts the results to places matching the specified type. Only one type may be specified (if more than one type is provided, all types following the first entry are ignored).

The only workaround of this would be to define one in the keyword attribute however this will return very inconsistent results.

The best way to do this is to do two separate API calls with differing types.

Upvotes: 2

Related Questions