-
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 a major release of the previously known ParkTAG SDK, an SDK used to build a parking app for iOS. The new structure of the SDK, opens up a wide range of new use cases outside parking
As a major release, following semantic versioning conventions, version 3.0 introduces several changes with its new architecture.
This guide is provided in order to ease the transition for existing applications using ParkTag 2.x to the latest SDK version, as well as explain the new design and structure.
- Instantiate the SDK
- Starting the SDK
- Stop the SDK
- Kick Start GPS
- Implementing the Protocol
- Delegate Methods
To initiate the SDK and setting up the delegate you used this so far:
var parktag: Parktag = Parktag.sharedInstance()
parktag.delegate = self
parktag.apiKey = "YOUR-API-KEY"
You have to update it to:
var predictIO: PredictIO = PredictIO.sharedInstance()
predictIO.delegate = self
predictIO.apiKey = "YOUR-API-KEY"
To start the SDK you used this so far:
Parktag.sharedInstance().startWithCompletionHandler({(error: NSError) -> Void in
if error != nil {
print("Error : \(error.description)")
}
})
You have to update it to:
PredictIO.sharedInstance().startWithCompletionHandler({(error: NSError) -> Void in
if error != nil {
print("Error : \(error.description)")
}
})
To stop the SDK you used this so far:
Parktag.sharedInstance().stop()
You have to update it to:
PredictIO.sharedInstance().stop()
To kick start GPS you used this so far:
Parktag.sharedInstance().kickStartGPS()
You have to update it to:
PredictIO.sharedInstance().kickStartGPS()
We've changed the protocol of our SDK. If you were implementing the old version of the protocol:
ParktagDelegate
You have to update it to:
PredictIODelegate
We have changed the call back functions of the SDK. Instead of multiple parameters we are now using the new PIOTripSegment object that also includes the transportation mode. Please note that the transportation mode is provided in a separate SDK callback function, For more details on the PIOTripSegment click here. Below you find the list of changed functions and how to update them.
if you used this so far:
func vacatingParking(location: CLLocation!)
You have to update it to:
func departing(tripSegment: PIOTripSegment!)
if you used this so far:
func vacatedParking(location: CLLocation!, startTime: NSDate!)
You have to update it to:
func departed(tripSegment: PIOTripSegment!)
if you used this so far:
func vacatedParkingCanceled()
You have to update it to:
func canceledDeparture()
if you used this so far:
func vehicleParkedSuspected(vacatedLocation: CLLocation!, parkedLocation: CLLocation!, vacatedTime: NSDate!, parkedTime stopTime: NSDate!)
You have to update it to:
func suspectedArrival(tripSegment: PIOTripSegment!)
if you used this so far:
func vehicleParked(vacatedLocation: CLLocation!, parkedLocation: CLLocation!, vacatedTime: NSDate!, stopTime: NSDate!)
You have to update it to:
func arrived(tripSegment: PIOTripSegment!)
If you used this so far:
func searchingParking(location: CLLocation!)
You have to update it to:
func searchingInPerimeter(searchingLocation: CLLocation!)
To use the transportation mode, you have to add this:
func detectedTransportationMode(transportationMode: TransportationMode)
For a complete reference of the API, please check out our API documentation and usage guide.