Post

Replies

Boosts

Views

Activity

Reply to CarPlay tab bar issues
Below is close to what I'm using in my CarPlay SceneDelegate. I'm still seeing the same results as before and I've minimized most of the code to reduce any chance of more issues arising. When the knob is focused on the tab selection I'm still getting a flicker upon calling func updateSections(_ sections: [CPListSection]). When an item is selected in the list and my app refreshes the list of items, then selected highlighted cell jumps from index 1 to random indexes in the list. My app handles a notification and refreshes the list template section and without updating sections the list never updates when adding or removing items. class MyCarPlaySceneDelegate: NSObject, CPTemplateApplicationSceneDelegate, CPInterfaceControllerDelegate { private var interfaceController: CPInterfaceController? private var template: CPListTemplate? private var items: [Item] = [] /// Maintain the list of items var tabTemplates = [CPTemplate]() func listTemplate() -> CPListTemplate { loadItems() /// Load items here to avoid code duplication var list: [CPListItem] = [] for item in items { list.append(item) } let template = CPListTemplate(title: "Library", sections: [CPListSection(items: list)]) template.updateSections([CPListSection(items: list)]) /// Without this here the second value in the list is highlighted self.template = template return template } func loadItems() { /// Loading data here } /// handle changes here to reload list @objc func handleNotification(_ notification: Notification) { var list: [CPListItem] = [] if let template = self.template { loadItems() /// Reload items when a notification is received template.updateSections([CPListSection(items: list)]) } } func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController) { NotificationCenter.default.addObserver( self, selector: #selector(handleNotification(_:)), name: Notification.Name.HELLOWORLD, object: nil ) self.interfaceController = interfaceController self.interfaceController?.delegate = self let template = listTemplate() tabTemplates.append(template) interfaceController.setRootTemplate(CPTabBarTemplate(templates: tabTemplates), animated: true, completion: nil) } func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didDisconnectInterfaceController interfaceController: CPInterfaceController) { self.interfaceController = nil NotificationCenter.default.removeObserver(self) } }
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’23
Reply to CarPlay tab bar issues
After more tinkering with, I’m left with the same issue when using with SwiftData. Adding/Removing items triggers a change in the highlighted item which is very strange behaviour and unable to resolve. Also the tab never really looks selected. The first indexed value should be highlighted but it switches randomly when updating template sections.
Topic: Programming Languages SubTopic: Swift Tags:
Nov ’23
Reply to CloudKit causes SwiftUI Menu to be dismissed
I’m having the exact same issue with Menu in SwiftUI dismissing itself. I’m using SwiftData and Core Data but I’m not using CloudKit though. I don’t remember this happening back on iOS 16 either. I noticed if I switch between tabs and toggle the menu, it dismisses itself. I’m running a task in the view and ended up moving it to my view model and calling it in the initializer, now I’m not seeing the Menu being dismissed.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’23
Reply to Xcode device DDI services error
To anyone having this issue, it seems iOS 17.1.1 and Xcode from the App Store wasn't compatible which is very strange. I didn't see any updates either. I ended up downloading Xcode 15.1 beta 3 and all is working now.
Replies
Boosts
Views
Activity
Nov ’23
Reply to CarPlay tab bar issues
Below is close to what I'm using in my CarPlay SceneDelegate. I'm still seeing the same results as before and I've minimized most of the code to reduce any chance of more issues arising. When the knob is focused on the tab selection I'm still getting a flicker upon calling func updateSections(_ sections: [CPListSection]). When an item is selected in the list and my app refreshes the list of items, then selected highlighted cell jumps from index 1 to random indexes in the list. My app handles a notification and refreshes the list template section and without updating sections the list never updates when adding or removing items. class MyCarPlaySceneDelegate: NSObject, CPTemplateApplicationSceneDelegate, CPInterfaceControllerDelegate { private var interfaceController: CPInterfaceController? private var template: CPListTemplate? private var items: [Item] = [] /// Maintain the list of items var tabTemplates = [CPTemplate]() func listTemplate() -> CPListTemplate { loadItems() /// Load items here to avoid code duplication var list: [CPListItem] = [] for item in items { list.append(item) } let template = CPListTemplate(title: "Library", sections: [CPListSection(items: list)]) template.updateSections([CPListSection(items: list)]) /// Without this here the second value in the list is highlighted self.template = template return template } func loadItems() { /// Loading data here } /// handle changes here to reload list @objc func handleNotification(_ notification: Notification) { var list: [CPListItem] = [] if let template = self.template { loadItems() /// Reload items when a notification is received template.updateSections([CPListSection(items: list)]) } } func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didConnect interfaceController: CPInterfaceController) { NotificationCenter.default.addObserver( self, selector: #selector(handleNotification(_:)), name: Notification.Name.HELLOWORLD, object: nil ) self.interfaceController = interfaceController self.interfaceController?.delegate = self let template = listTemplate() tabTemplates.append(template) interfaceController.setRootTemplate(CPTabBarTemplate(templates: tabTemplates), animated: true, completion: nil) } func templateApplicationScene(_ templateApplicationScene: CPTemplateApplicationScene, didDisconnectInterfaceController interfaceController: CPInterfaceController) { self.interfaceController = nil NotificationCenter.default.removeObserver(self) } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to CarPlay tab bar issues
After more tinkering with, I’m left with the same issue when using with SwiftData. Adding/Removing items triggers a change in the highlighted item which is very strange behaviour and unable to resolve. Also the tab never really looks selected. The first indexed value should be highlighted but it switches randomly when updating template sections.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to CarPlay support for SwiftUI app
I resolved my issue by adding correct Entitlements! 🙄
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to CarPlay simulator broken
I uninstalled Xcode and reinstalled, now it’s working again.
Replies
Boosts
Views
Activity
Oct ’23
Reply to CloudKit causes SwiftUI Menu to be dismissed
I’m having the exact same issue with Menu in SwiftUI dismissing itself. I’m using SwiftData and Core Data but I’m not using CloudKit though. I don’t remember this happening back on iOS 16 either. I noticed if I switch between tabs and toggle the menu, it dismisses itself. I’m running a task in the view and ended up moving it to my view model and calling it in the initializer, now I’m not seeing the Menu being dismissed.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’23
Reply to Combine AnyCancellable.store(in:) EXC_BAD_ACCESS
I'm not having an issue while using async in another project I'm working on using a different API. The application it's crashing on never experienced this before, but after the recent update to Xcode it's crashing. It's not a constant crash, it's not predictable.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Apr ’23
Reply to Group Activities for non-paid developer account?
Checking the documentation doesn't specify. I haven't heard back from any Apple engineering members but I assume the answer is yes, you need a paid developer account.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Apr ’23
Reply to Xcode 13.2.1 Could not resolve package dependencies
Deleting Package.resolved corrected the issue.
Replies
Boosts
Views
Activity
Apr ’22