TrashMapper - iOS Project - Development - Part3
Integration of Firebase into project. Implement MapView and updated Tab bar/Nav bar controllers.
Few more updates added…
Outline functionality for:
Build out the User Interface

To zoom in on the user, we first define a region with struct MKCoordinateRegion with initializer:
init(center: CLLocationCoordinate2D, latitudinalMeters: CLLocationDistance, longitudinalMeters: CLLocationDistance)
The CLLLocationCoordinate2D can be pulled from the mapview to point at user position.
Wrap this into a function and add an IBAction from the Arrow button so that it implies “zoom to user location”, similar to how Google maps does it.
@IBAction func getUserLocation {
//create a region to zoom on
let region = MKCoordinateRegion {
center: mapView.userLocation.coordinate, //grab user coordinate
latitudinalMeters: 1000, //lat span
longitudinalMeters: 1000) //long span
}
//Change to the region provided within this method
mapView.setRegion(
//adjust the region with proper aspect ratios and centerpoint
mapView.regionThatFits(region),
animated: true
)
}