ALL BUSINESS
COMIDA
DIRECTORIES
EDUCATIONAL
ENTERTAINMENT
FASHION TIPS
FINER THINGS
FREE CREATOR TOOLS
HEALTH
MARKETPLACE
MEMBER's ONLY
MONEY MATTER$
MOTIVATIONAL
NEWS & WEATHER
TECHNOLOGIA
TELEVISION NETWORKS
USA VOTES 2024
VIDEOS
INVESTOR RELATIONS
IN DEVELOPMENT
Posted by - Latinos MediaSyndication -
on - May 11, 2023 -
Filed in - Technology -
-
336 Views - 0 Comments - 0 Likes - 0 Reviews
I have a full SwiftUI project/app (In the AppStore) that I would like to add some CarPlay functionality. I have the entitlement correctly setup and am able to see the icon on the CarPlay simulator.
I have tried various info.plist configurations with various class configurations and only achieve crashes at the moment when starting the app in the simulator.
I'm a bit confused about the way to go about displaying views. I would like to start with a simple "Hello world" but even that is challenging :)
This question seems to be the kind of thing that I require but doesn't go in to enough details on the AppDelegate configuration.
iOS 15.4 - SwiftUI + CarPlay - State not updating
This looks promising but again not enough detail for me:
https://dev.to/nitricware/adding-carplay-to-a-swiftui-life-cycle-app-h9h
This too , but I suspect it's an older way of displaying the views.
https://www.adapptor.com.au/blog/enhance-existing-apps-with-carplay
If I could get help with a simple "Hello World" I would be most grateful!
From info.plist
<key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <true/> <key>UISceneConfigurations</key> <dict> <key>CPTemplateApplicationSceneSessionRoleApplication</key> <array> <dict> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_MODULE_NAME).CarPlaySceneDelegate</string> </dict> </array> </dict> </dict>
CarPlaySceneDelegate.swift
import Foundation import CarPlay class CarPlaySceneDelegate: UIResponder, CPTemplateApplicationSceneDelegate { func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController) { let screen = CPInformationTemplate(title: "Root", layout: .leading, items: [CPInformationItem(title: "Hello", detail: "CarPlay")], actions: []) interfaceController.setRootTemplate(screen, animated: true, completion: { _,_ in // Do nothing }) } }
Thanks