Create a Draggable Map Like Uber , OLA in iOS using Swift 4

Draggable Map.

We have seen the Ola or Uber map where the pin is located in middle of Google Map & we can Drag the Map or Zoom also after doing all this , map stop dragging or zooming then

it will show their actual address where the pin located. In iOS we can use Apple Map or Google Map so here I have taken the Example of Google Map.

Please follow this steps.

1: Install the Google Map Framework through POD.

2: Write the Gopogle Map Key in Appdelegate class.

3: Create a view controller & take a one UIView .

Take the one UIView in UIViewController & set the leading , trailing , top , bottom constraints to super view , after that take one UIImageView in middle of UIView and set the constraints  center Horizontal & center vertical.

 

4: Create outlet of UIview & pin Image.

5 : Now setup your Map for this I have written the function where i have set the default latitude & longitude.

Note: it will show the PIN image on your given Latitude & Longitude position. 

Now I have to  implement the dragging functionality for this you need to write the delegate method to check when the map is at idle position after dragging. here i have used the geocode for getting the address through latitude & longitude.

 

6: This Method will call when the Map is at idle position after dragging.

Note: Now you can get the PIN position Address.

 

 

 

 

Thanks for reading this Technical blog, I Hope this is helpful for you. If you got any query or issue please ask me on the comment below.

                                                                                                                                                     Stay updated and Stay Cool. 🙂

 

. . .

Comments (4)

Add Your Comment

  • Aashish
    Could you plaese send me the source code
  • Aashish
    Could you plaese send me the source code?
    • kunal prasad
      Can you tell me, what’s an issue you are facing?
      • aashish
        PIN position Address ,city is not fetched on the textfield.
  • css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close