-
Notifications
You must be signed in to change notification settings - Fork 4
Swift Migration Guide for predict.io 3.0
predict.io 3.0 is the major release of the previously known ParkTAG SDK, a delightful parking solution for iOS, that now is made available for a wide range of new uses cases. As a major release, following Semantic Versioning conventions, 3.0 introduces several changes with its new architecture.
This guide is provided in order to ease the transition of existing applications using Parktag 2.X to the latest SDK, as well as explain the new design and structure. In predict.io 3.0 instead of multiple parameters we are using PIOTripSegment object for more details click here
To initiate the SDK and setting up delegate.
var parktag: Parktag = Parktag.sharedInstance()
parktag.delegate = self
parktag.apiKey = "YOUR-API-KEY"
You should update it to:
var predictIO: PredictIO = PredictIO.sharedInstance()
predictIO.delegate = self
predictIO.apiKey = "YOUR-API-KEY"
To start SDK.
Parktag.sharedInstance().startWithCompletionHandler({(error: NSError) -> Void in
if error != nil {
print("Error : \(error.description)")
}
})
You should update it to:
PredictIO.sharedInstance().startWithCompletionHandler({(error: NSError) -> Void in
if error != nil {
print("Error : \(error.description)")
}
})
To stop SDK.
Parktag.sharedInstance().stop()
You should update it to:
PredictIO.sharedInstance().stop()
For kick start GPS.
Parktag.sharedInstance().kickStartGPS()
You should update it to:
PredictIO.sharedInstance().kickStartGPS()
We've changed the protocol of our SDK. If you were implementing the old version of protocol.
ParktagDelegate
You should update it to:
PredictIODelegate
We also changed the call back functions of SDK and detect the transport mode which is provided in SDK call back functions. Below is the list of changed function.
func vacatingParking(location: CLLocation!)
You should update it to:
func departing(tripSegment: PIOTripSegment!)
func vacatedParking(location: CLLocation!, startTime: NSDate!)
You should update it to:
func departed(tripSegment: PIOTripSegment!)
func vacatedParkingCanceled()
You should update it to:
func departureCanceled()
func vehicleParkedSuspected(vacatedLocation: CLLocation!, parkedLocation: CLLocation!, vacatedTime: NSDate!, parkedTime stopTime: NSDate!)
You should update it to:
func arrivalSuspected(tripSegment: PIOTripSegment!)
func vehicleParked(vacatedLocation: CLLocation!, parkedLocation: CLLocation!, vacatedTime: NSDate!, stopTime: NSDate!)
You should update it to:
func arrived(tripSegment: PIOTripSegment!)
func searchingParking(location: CLLocation!)
You should update it to:
func searchingInPerimeter(searchingLocation: CLLocation!)
You should add this
/* This method is invoked when predict.io detects transportation mode
* @param: transportationMode: Mode of transportation
*/
func transportationMode(transportationMode: TransportationMode)
For a complete reference of the API, please check out our API documentation and usage guide.