Get started
Prerequisite
Before starting DriveKit Vehicle UI integration, make sure that you have initialized Vehicle and Common UI components, especially if you have disabled the SDK auto-initialization.
Integration
To add the Vehicle UI module to your app:
Swift Package Manager: Add
DriveKitVehicleUIfrom repository:https://github.com/DriveQuantPublic/drivekit-ui-ios.gitas dependency.Cocoapods: add the following pod to your Podfile:
target 'my-target' do
pod 'DriveKitVehicleUI'
endThen, run pod install.
Project configuration
In the vehicle detail screen, it is possible to change the picture of the vehicle. Because of this possible access to the user's Photo library or the camera, you must add the keys NSPhotoLibraryUsageDescription and NSCameraUsageDescription in your Info.plist file.
Initialization
If you have disabled the SDK auto-initialization, the Vehicle UI module must also be manually initialized. In the application's AppDelegate file, import DriveKitVehicleUI:
import DriveKitVehicleUIThen, to initialize Vehicle UI module in your app, you must call the initialization method in didFinishLaunchingWithOptions method of your AppDelegate:
import DriveKitCore
import DriveKitCommonUI
import DriveKitVehicleUI
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
DriveKit.shared.initialize()
DriveKitUI.shared.initialize()
DriveKitVehicleUI.shared.initialize()
...
}Display vehicle list
To display the vehicle list to the driver, just call the following method:
self.navigationController?.pushViewController(DriveKitVehicleUI.shared.getVehicleListViewController(), animated: true)
Display vehicle detail
To display the vehicle detail, just call the following method:
DriveKitVehicleUI.shared.getVehicleDetailViewController(vehicleId: viewModel.trip.vehicleId, completion: { [weak self] viewController in
DispatchQueue.main.async {
if let vehicleDetailViewController = viewController {
self?.navigationController?.pushViewController(vehicleDetailViewController, animated: true)
}
}
})
Display vehicle picker
To display vehicle selection screens, just call the following method:
DKVehiclePickerNavigationController(parentView: <UIViewController>, detectionMode: <DKDetectionMode>, vehicle: nil, completion: {
// End of vehicle selection
})Last updated
Was this helpful?

