There are two ways that a user can place a marker on a map inside the application through the UISearchBar above the map (not yet completed) and long press on the map where they would like the marker to be displayed. I use a global variable for a marker because the user is not allowed to set only one marker on the map. Whenever a marker is created, I would like to draw a radius (circle) around the marker. Here is my code:
var mapMarker = GMSMarker() ...
Admittedly, this is my first iOS / Swift app. I wondered if I passed the coordinates from didLongPressAtCoordinate to the drawCircle () function, but apparently I'm doing something wrong. I searched all day for help, but just found Android and Google Maps API v3. Thanks!
EDIT My code works, but the radius does not scale, and an icon appears above the icon. When I zoomed in on the map, I was able to see the radius. There are three problems:
- The icon does not scale depending on the zoom level of the map.
- The radius does not scale based on the map zoom level.
- If the marker position is updated, the radius does not move with it. Instead, a new radius is drawn ... so there are two radii on the map.
source share