Main pain points in Carplay and how to deal with it

Alberto García
SEAT CODE
Published in
5 min readMay 24, 2023

Here, At SEAT:CODE, we’re always looking for new challenges, improve knowledge and experiment with latest technologies, sometimes it’s an easy trip, but sometimes is more complicated and we find some pain points… but looking at the positive side, we can share with you our knowledge about this pain points and maybe you can avoid some of them (or at least be aware of it!).

To share with you the context of the situation, we started some months ago an internal project to make a proof of concept of an iOS application connected to the car through Apple CarPlay. This had to be an Automaker app, without using Carplay’s templates in order to make a fully customized interface, as a normal iOS app is.

It has been a long trip, where we found several stones in our path. Here you have the most important ones:

1. Becoming an Automaker and entitlements

If you want to create an Automaker app, there’s a manual validation from Apple that must be passed. In this article from Apple’s official site you can find the process to be validated as an Automaker brand in your Apple Connect account.

In all this process there’s a part that is not easy to know, the way that your app recognizes your car. If you want to get your app visible in the Carplay, first you have to know the protocol of your car. A protocol is a string in a form of path that the car must have internally setted and the iOS app also must get it in the entitlements file. Here you can find an example of this protocols:

Also, we have to note that these protocols must be exactly the same in the car, in the app and also in the Provisioning profile of the app. One of the pain points is that, if by some reason you have to change the protocols given in the Provisioning Profile, you have to contact with Apple Carplay’s team again to request this changes (at least, it’s the way to go in the moment we are writing this article :P).

2. The knob dial

Our first pain point (and believe me, it was a real PAIN), was to adapt the application to be controlled by a knob dial. For product-related purposes, the target of the cars where the app could be used changed from the ones with a touch MMI to all cars with MMI, including the ones controlled by this “small wheel” known as knob dial.

The knob dial

It’s not a real pain if you’re using in your project the CarPlay templates, but in an Automaker app, with fully custom interface, we have been digging inside SwiftUI’s elements to be able to detect the focus of knob dial and react to it, changing colors, executing actions or whatever was needed.

For this purpose we used a ViewModifier to be added in all focusable views, here you have our solution to this pain point:

struct FocusableViewModifier: ViewModifier {
@Binding var currentBorderColor: LinearGradient
@FocusState private var focus: String?
@State private var focusState = false

private var borderColors: FocusableColors
private let value: String?
private let tapAction: () -> Void

public init(
index: String,
currentBorderColor: Binding<LinearGradient>,
borderColors: FocusableColors,
tapAction: @escaping () -> Void
) {
value = index
self.tapAction = tapAction
_currentBorderColor = currentBorderColor
self.borderColors = borderColors
}

public func body(content: Content) -> some View {
return ZStack {
Group {
Toggle("", isOn: $focusState).onChange(of: focusState) { _ in
tapAction()
}
.opacity(0.1)
.focused($focus, equals: value)
}
.frame(minWidth: 1, maxWidth: 1, minHeight: 1, maxHeight: 1)
.cornerRadius(100)

content.onChange(of: focus) { newValue in
currentBorderColor = newValue == value ? borderColors.focused : borderColors.initial
}
}
}

}

3. Screen sizes

One good point of being an iOS engineer is that the screen sizes and ratios are standardized and there’s just “a few” different types… but with Carplay, a new player enters the game. Now we have to be aware of the different MMI’s sizes and is especially important if we want to re-use some of our views to be used in carplay and in iPhone, as some cars can have very small screens.

It can be a nightmare for designers and developers, as we have to think always in this different sizes to have a clear and well defined user interface. Sometimes we can make something adapted without big changes but in other cases the interface is completely different from iPhone and Carplay. If this is the case, we can use UIUserInterfaceIdiom from UIKit to know which device type is being used. The interface idiom can be retrieved from the UIScreen object and the traitCollection property.

Here you have a piece of code about how to retrieve it.

func isCarplay(_ screen: UIScreen) {
screen.traitCollection.userInterfaceIdiom == UIUserInterfaceIdiom.carPlay
}

4. Frozen SceneKit-related content

Some sections in our application are using Apple’s SceneKit to render some 3D content. This content looks pretty cool in MMI’s screen and we have not experienced performance problems, at least with the 3D models used, but we found an important bug that, at the moment, we can not solve.

The bug is reproduced when the user is using a SceneKit view to display some kind of 3D content and this view should react in some way to the user’s gestures. If the iPhone has the screen switch-off, the SceneKit view becomes frozen. As soon as the user turns on the screen, even if the phone is locked all the gestures that the user made are reproduced at the same moment.

We have been struggling with it and, bad news, we couldn’t find a way to make a workaround to avoid this situation, but at least if you’re in the way to use SceneKit in your Carplay app, be aware of this problem!

Ah, and one more detail related to this problem… we could reproduce it only using a real environment, I mean, in a real car. Using the simulator seems to work like a charm!

And the story continues…

These were the main pain points that we found. We hope that this article will help you in your swifty adventures with Apple Carplay. Let us know in the comments if you found more pain points related to Carplay or if you have better solutions to the problems mentioned here… as engineers we must keep learning and sharing knowledge!

We will keep writing more Apple Carplay-related articles, follow us to stay tuned 😁

--

--