Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

highjump0615/AxRide

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

80 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AxRide

iOS App; Taking passengers to destination

Overview

Simple Taxi App that user can request ride to nearby drivers

Main Features

  • Basic features
    Signup, Login, Profile, Setting, ...

1. User POV

  • Set location and destination on the map
  • Send request to nearby drivers
  • Draw routes on the map when ride has made
  • Messaging with driver

2. Driver POV

  • Accept or decline incoming ride request
  • Draw routes on the map when ride has made
  • Messaging with user

Techniques

Main language: Swift 4.0

1. UI Implementation

  • Implementing view controllers with individual xib interface
  • TableView cell and CollectionView cell should be implemented independent xib file
    • Register nib for table view cell
      UITableView.register()
  • Showing map using Google Maps
    GMSCoordinateBounds is used to show multiple points in one screen
  • Adding border to view programmatically
func addBottomBorderWithColor(color: UIColor, width: CGFloat) {
    // the height of view may change, so we use autoresizing
    let border = UIView(frame: CGRect(x: 0, y: self.frame.size.height - width, width: self.frame.size.width, height: width))
    border.backgroundColor = color
    border.autoresizingMask = [.flexibleWidth, .flexibleTopMargin]
    self.addSubview(border)
}

2. Function Implementation

  • Getting location using CLLocationManager()
    locationManager.startUpdatingLocation()
  • Google Firebase for backend
    • GeoFire for location saving & querying
  • Push notification using Firebase Clound Messaging(FCM)

2.1 Data flow & use

- Request a ride
  • Add data record to requests table {userId} / orderData
  • Add marks to accepts table
    {driverId} / {userId} / "request"
- Driver accepted the request
  • Remove data from requests table
  • Remove marks from accepts table
  • Add data to picked table
    {userId} / orderData
    {driverId} / orderData
- Arrived destination
  • Add data to arrived table
    {userId} / {driverId} / true
- Fee Paid
  • Add data to bookhistories table
    {userId} / orderData
    {driverId} / orderData
  • Remove data from arrived table
  • Remove data from picked table

2.2 Rest APIs

Stripe Payment Setup
  • /api/ephemeral_keys
    Gets Stripe ephemeral key
  • /api/createCustomStripe
    Creates Stripe cusomer Id for user
  • /connectStripe?email=mail address
    Web url getting Stripe accound Id for driver
Payment
  • /api/order
    Sending payment from user to driver
Stripe APIs

2.3 Stripe iOS Integration

2.4 Db structure

|
+-- addresses
|  |
|  +-- {userId}
|     |
|     +-- {id}
|
+-- bookhistories
|  |
|  +-- {userId (driver)}
|  |  |
|  |  +-- {orderId}
|  |
|  +-- {userId (user)}
|     |
|     +-- {orderId}
|
+-- driverstatus
|  |
|  +-- {userId}
|
+-- messages
|  |
|  +-- {userId (sender)}
|  |  |
|  |  +-- {userId (receiver)}
|  |     |
|  |     +-- {id}
|  |
|  +-- {userId (receiver)}
|     |
|     +-- {userId (sender)}
|        |
|        +-- {id}
|
+-- picked
|  |
|  +-- {userId (driver)}
|  |
|  +-- {userId (user)}
|
+-- rates
|  |
|  +-- {userId}
|     |
|     +-- {id}
|
+-- users
   |
   +-- {id}

3. Code tricks

Custom fonts with propotional font size to screen size

label.font = ARTextHelper.exoBold(size: width / widthDesign * 30)

Methods with completion callback using closures

func readFromDatabase(withId: String, completion: @escaping((Any?)->())) {
}

Delegate in Swift

PopupDelegate in UserWaitPopup.swift

protocol PopupDelegate: Any {
    func onClosePopup(_ sender: Any?)
}

Common module

  • PaymentMethodHelper & ARPaymentMethodDelegate
    Common pages for Stripe Payment Setup
  • PhotoViewHelper & ARUpdateImageDelegate
    Added tag for multiple photo controls in a page

4. Third-Party Libraries

Google Maps v2.7.0

  • Firebase Auth
  • Firebase Database
  • Firebase Storage
  • Firebase Messaging

Need to Improve

Add and update features

About

iOS App; Taking passengers to destination

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published