Skip to content
/ Track-Car Public template

Create the application where user can track the car on the map, same like OLA and Uber application do.

License

Notifications You must be signed in to change notification settings

ram2386/Track-Car

Repository files navigation

Track-Car

Track-Car makes it easy to add tracking functionalities to your iOS app!

Demo

Features

  • Use Combine framework for location handling
  • Use Decodable protocol for JSON parsing
  • Support Landscape mode
  • Dark mode

Requirements

  • iOS 13.0+
  • Xcode 11.0+
  • Swift 5.0+

Installation

Manually

Just download the project, drag and drop the "TrackCar" folder in your application.

Usage

  1. Create the LocationService and implement in your view controller
class YourViewController: {
    let locationService = LocationService()    
}
  1. Subscribe the PassthroughSubject subject which send the location at 1 second interval
   cancelSubject = locationService.locationSubject
              .receive(on: DispatchQueue.main)
              .sink(receiveCompletion: { (completion) in
              switch completion {
                  case .failure(let error):
                      ....
                  case .finished:
                      break
              }
              }) { [weak self] (item) in
                  self?.updateCarLocation(model: item)
              }
    
    locationService.setupTimerPublisher()

And cancel the subscriber when it no longer needs to receive elements. For ie. cancelSubject.cancel()

  1. Implement the updateLocationOnMap method of LocationService class where you need to pass the refernce of your MapView, location and MKAnnotation
func updateCarLocation(model: CarModel) {
 self.locationService?.updateLocationOnMap(model: model, myAnnotation: myAnnotation, mapView: mapView)
}

Roadmap

Feature

  • Add CocoaPods
  • Show the path on the map
  • Show the callout view when tapping on car icon

Improvements/To Do

  • Apply the smooth animation while moving the car on the map

License

Track-Car is available under the MIT license, see the LICENSE file for more information.

About

Create the application where user can track the car on the map, same like OLA and Uber application do.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages