# Get started

## **Prerequisite**

Before starting DriveKit Vehicle UI integration, make sure that you have initialized [Vehicle](https://docs.drivequant.com/vehicle/ios/get-started) and [Common UI ](https://docs.drivequant.com/common-ui/ios/get-started)components, especially if you have [disabled the SDK auto-initialization](https://docs.drivequant.com/get-started-drivekit/ios/advanced-configurations#manually-initialize-the-sdk).&#x20;

## **Integration**

To add the Vehicle UI module to your app using **Swift Package Manager,** add `DriveKitVehicleUI` from repository: `https://github.com/DriveQuantPublic/drivekit-ui-ios.git` as dependency.

{% hint style="info" %}
On this [Github repository](https://github.com/DriveQuantPublic/drivekit-ui-ios), you can find a demo app and the source code of Vehicle UI that you can use as an example.
{% endhint %}

## Project configuration

{% hint style="warning" %}
In the [vehicle detail screen](https://docs.drivequant.com/vehicle/user-interface/ios/get-started#display-vehicle-detail-in-navigation-controller), 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`](https://developer.apple.com/documentation/bundleresources/information_property_list/nsphotolibraryusagedescription) and [`NSCameraUsageDescription`](https://developer.apple.com/documentation/bundleresources/information_property_list/nscamerausagedescription) in your `Info.plist` file.
{% endhint %}

## Initialization

If you have [disabled the SDK auto-initialization](https://docs.drivequant.com/get-started-drivekit/ios/advanced-configurations#manually-initialize-the-sdk), the Vehicle UI module must also be manually initialized. In the application's AppDelegate file, import `DriveKitVehicleUI`:

```swift
import DriveKitVehicleUI
```

Then, to initialize Vehicle UI module in your app, you must call the initialization method in `didFinishLaunchingWithOptions` method of your AppDelegate:

```swift
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:&#x20;

```swift
self.navigationController?.pushViewController(DriveKitVehicleUI.shared.getVehicleListViewController(), animated: true)
```

![](https://2525923625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXYIG5U3AO65YYFWJRK%2Fuploads%2F9hMvMHb4C3gaPlajUxpG%2Fimage.png?alt=media\&token=5cc2f1d1-40ad-429f-99f4-155bd302ebd3)

### **Display vehicle detail**

To display the vehicle detail, just call the following method:&#x20;

```swift
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)
        }
    }
})
```

![](https://2525923625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXYIG5U3AO65YYFWJRK%2Fuploads%2FuKjmiJav3Vj3mKBcRBGR%2Fimage.png?alt=media\&token=67ac11d2-1f0e-49a7-9857-efc186cf2ecb)

### **Display vehicle picker**

To display [vehicle selection screens](https://docs.drivequant.com/vehicle/user-interface/ios/main-configurations#vehicle-selection-mode), just call the following method:

```swift
DKVehiclePickerNavigationController(parentView: <UIViewController>, detectionMode: <DKDetectionMode>, vehicle: nil, completion: {
    // End of vehicle selection
})
```
