Skip to content

App "The Point" - UITableView / Realm / RatingControl / CosmosStar / MapVC / User Location

Notifications You must be signed in to change notification settings

tsolovart/Point

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logoAppPoint App Point

logoAppPoint You can Add your favorite places to a list to find them easily later. Manage your saved places

Skills

  • UITableView
  • Realm
  • RatingControl
  • CosmosStar
  • MapVC
  • User Location

Сreate

addText

Location

Find out your location address

location

Photo of the Place

Take pictures of places

takePhoto

Search and Sorting

Sort by date added and by name

search

Get Direction & Show Route

let locationManager = CLLocationManager()

func getDirections(for mapView: MKMapView, previousLocation: (CLLocation) -> ()) {

User Location Coordinates

        guard let location = locationManager.location?.coordinate else {
            showAlert(title: "Error", message: "Current location is not found")
            return
        }

The mode used to track the user location

        locationManager.startUpdatingLocation()
        previousLocation(CLLocation(latitude: location.latitude, longitude: location.longitude)) 

Route request

        guard let request = createDirectionRequest(from: location) else { 
            showAlert(title: "Error", message: "Destination is not found")
            return
        }

Draw a route

        let directions = MKDirections(request: request) 
        resetMapView(withNew: directions, mapView: mapView)

Route calculation

        directions.calculate { (response, error) in 
            
            if let error = error {
                print(error)
                return
            }

Fetch route

            guard let response = response else { 
                self.showAlert(title: "Error", message: "Destinations are not available")
                return
            }

Route selection. Overlay routes

            for route in response.routes { 
                mapView.addOverlay(route.polyline)

Focusing the map

                mapView.setVisibleMapRect(route.polyline.boundingMapRect, animated: true)   

Travel Time and Distance. %.1f - round up to 0,1

                let distance = String(format: "%.1f", route.distance / 1000) 
                let timeInterval = route.expectedTravelTime
            }
        }
    }

route

Follow me

linkedin instagram facebook twitter behance

About

App "The Point" - UITableView / Realm / RatingControl / CosmosStar / MapVC / User Location

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published