Hi,
I am working on my current iPhone app to be supported in CarPlay. I already got approved by Apple CarPlay team, received the development entitlement, read the CarPlay related programming guide, and watched the video "Enabling Your App for CarPlay" (https://developer.apple.com/videos/play/wwdc2017/719/). In the video there is a piece of Swift code demonstrating how to add CarPlay UI:
func updateCarWindow()
{
guard let screen = UIScreen.screens.first(where: { $0.traitCollection.userInterfaceIdiom == .carPlay })
else
{
// CarPlay is not connected
self.carWindow = nil;
return
}
// CarPlay is connected
let carWindow = UIWindow(frame: screen.bounds)
carWindow.screen = screen
carWindow.makeKeyAndVisible()
carWindow.rootViewController = CarViewController(nibName: nil, bundle: nil)
self.carWindow = carWindow
}My questions are:
1. How to add tabs in my app for CarPlay? I have added the following to my Info.plist file:
<key>UIBrowsableContentSupportsSectionedBrowsing</key>
<true/>
What are the next steps to add, for example, 3 tabs, into my app?
2. If I'd like to add a button in my app, how should I do that?
3. I am new in Swift. How to convert the above Swift code, especially the "guard" body, to Objective-C code?
Thanks a lot in advance.