Coder Social home page Coder Social logo

ram2386 / track-car Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 5.0 19.29 MB

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

License: MIT License

Swift 100.00%
swift mkmapview mkannotation combine-framework track-car

track-car's Introduction

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.

track-car's People

Contributors

ram2386 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.