Posts

Showing posts from October, 2018

How to create a Map View in iOS (swift 4)

Image
Map View MKMapView and MKMapViewDelegate Introduction in Swift If you need to show a map to your users in iOS, one way to accomplish this is to use the MKMapView class. Mix this with the MKMapViewDelegate and you have the ability to detect movement on the map, detect the state of the map such as failure loading it as well as several other items you can monitor. In this tutorial we’ll add a map to the view, allow the current location of the phone to be zoomed to, and allow the user to switch between the different map types which are available meaning Standard, Satellite, and Hybrid. We will also learn how to implement a delegate method and have the map move each time the user moves. MKMapView Tutorial The first step is to create a Single View Application by opening Xcode and creating the new project. You can follow  this tutorial  if you are unsure how to create a new project. Make sure you select the language as Swift. You can uncheck unit tests, core data, and oth