annotations – Finding nearby Table I: Place Types in proximity to user’s current location using Google Places API on iOS – SwiftUI


Problem: I’m pretty new to SwiftUI and to coding mobile in general so far, but I’m attempting to create an app that finds ONLY nearby place types (restaurants, parks, cafes) from the Table I Place Types Google Places API offers: place types. These locations would appear in the radius around the user’s current location and each place would be annotated with a marker/annotation automatically when the app is opened (no search bar is used). There would also be a refresh icon on the screen that would update these Table I place type locations (restaurants, parks, cafes…) around the blue pin marker, as done in the tutorial.

What I’ve Tried: I have been searching on Google, Stackoverflow, and Github for examples or tutorials with the tutorial by raywenderlich coming the closest to providing the answer. My only issue with this: tutorial is that it is coded partly using storyboards (which is something I want to avoid for now). If someone can steer me into the right direction on how to implement the fetchPlaces function in the MapViewController into the new SwiftUI (without using storyboards, if possible), I would greatly appreciate it, as I am really struggling to figure it out on my own and with the help of Google’s documentation.

This image is taken from the raywenderlich tutorial as an example. It shows ONLY restaurants and cafes in a radius around the user’s current location on opening the app. The refresh icon in the top left corner refreshes these locations around the blue pin marker in the middle of the screen on the map.

P.S: I have tried using Apple’s MapKit instead of Googles Maps SDK for iOS, also with no success. However, any advice using MapKit instead of Google Maps would also be appreciated. Either or is fine with me.