TruckerPathKit
Introduction
Welcome to the official Trucker Path Swift Library
The Trucker Path SDK offers our partners the ability to fetch information and interact with Trucker Path services (comprehensive information on places including truck stops, parking places, weigh stations, fuel stops, and more) in a simple, controlled and effective manner.
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
Requirements
Our master branch and our releases are now on Swift 5.
Deployment target: iOS12.0
Installation
TruckerPathKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'TruckerPathKit'
Initializing and Usage
Integrate
Import TruckerPathKit into AppDelegate.swift, and initialize TruckerPath within application:didFinishLaunchingWithOptions:
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
TruckerPath.sharedInstance().setApiKey("TruckerPath_ApiKey")
}
Usage
-
Search Places
TruckerPath.sharedInstance().getExtendedPlaceByDistance(from: CLLocationCoordinate2D, inRadius: radius)
-
Update Status with existing controls
TPPUpdateStatusManager.sharedInstance.showUpdateView(place){ (updateSuccessed) in if updateSuccessed { print("Update status succeeded") } else { print("Update status Failed") } }
-
Update Status with APIs
//update Truck Stop status api, status can be: "free", "some", "full" TruckerPath.sharedInstance().updateTruckStopStatus(withPlaceID:placeId, status: status) { (error) in if error == nil { print("Update status succeeded") } } //update Weigh Station status api, status can be: "closed", "open", "monitor" TruckerPath.sharedInstance().updateWeighStationStatus(withPlaceID:placeId, status: status) { (error) in if error == nil { print("Update status succeeded") } }
-
Get Diesel Price
//Get Diesel price of FuelStations //placeIDs: array of placeId, Support one or more TruckerPath.sharedInstance().getDieselPrices(withPlaceIDs: [1, 2]) { (object, error) in }
-
Add Reviews
//Add a new Review under Place //text: Content of Review //rating: Rating the Place (1-5 stars) //placeID: Target Place.id TruckerPath.sharedInstance().addReview(text, rating: rating, placeID: placeId) { (object, error) in }
-
Remove Reviews
//Remove a Review with ReviewID //reviewId: Target ReviewID TruckerPath.sharedInstance().removeReview(withReviewId: reviewId) { (object, error) in }
-
Get Reviews
//Get Reviews of Place //placeID: Target Place.id //limit: Review Count per Page //page: Current Page number TruckerPath.sharedInstance().getReviews(placeId, limit: limit, page: page) { (object, error) in } //Get Reviews of yourself TruckerPath.sharedInstance().getMyReviews { (object, error) in }
Author
Trucker Path Inc.
License
TruckerPathKit is available under the MIT license. See the LICENSE file for more info.