Create Draggable Map Like Uber OLA in iOS Using Swift 4

Updated 30 November 2023

Save

Draggable Map

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

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

Please follow these steps.

1: Install the Google Map Framework through POD.

2: Write the Google Map Key in the Appdelegate class.

3: Create a view controller & take one UIView.

Take one UIView in UIViewController & set the leading, trailing, top, and bottom constraints to super view.

After that take one UIImageView in the middle of UIView and set the constraints center Horizontal & centre vertical.

4: Create an outlet of UIview & pin the Image.

5: Now set 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 and 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 an 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 an idle position after dragging.

Note: Now you can get the PIN position Address.

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

Thanks for reading this technical blog, I Hope this is helpful for you. If you have any query or issue please ask me in the comment below.

Stay updated and Stay Cool.

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


9 comments

  • Aashish
  • Aashish
    • kunal prasad (Moderator)
      • aashish
  • Kiran
  • vinay
  • KOSURU UDAY SAIKUMAR
  • Ahsan Iqbal
    • anchit (Moderator)
  • Start a Project


      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home