I have a list of items/cells where each item has many elements within it including a button. On tap of a cell, it navigates to screen say ViewA. And on tap of button within the cell, it goes to ViewB. However, on tap of the cell, instead of navigating to ViewA, it randomly navigates to ViewB even though the nav link isActive is disabled. Please suggest!
ViewA - List view
`List {
ForEach(testData, id: \.self) { index in
ZStack {
NavigationLink("", destination:ViewA()).opacity(0)
ViewAListItem()
}.listRowBackground(Color.clear)
.listRowSeparator(.hidden)
.background(.clear)
}
}`
In another file,
struct ViewAListItem: View {
@State var test: Bool = false
/// some other code
///
///
///
Button(action: {
test = true
}) {
Text("Testing")
}.background(
NavigationLink("", destination: ViewB(), isActive: $test).opacity(0)
)
}
Here even though the button is not tapped, variable test is true and navigating to ViewB on tap of cell which should launch ViewAListItem instead. Any issue with this?
Post
Replies
Boosts
Views
Activity
Following is a row item within a section of CPListTemplate,
CPListItem(text: "Station 1", detailText: "Details\nforStation 1")
In the above, is it possible to display data in three lines? I have seen couple of CarPlay apps that do it within a list. However, I am not sure how this can be done. Kindly suggest some ideas
Currently I have the below,
I want to achieve the below, three lines with a row
I have a SwiftUI app, and Apple has approved the Carplay entitlement. The entitlement integration is done successfully, however when I try to launch the carplay app I get the below error
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Application does not implement CarPlay template application lifecycle methods in its scene delegate.'
Info.plist:
UIApplicationSceneManifest
UIApplicationSupportsMultipleScenes
UISceneConfigurations
CPTemplateApplicationSceneSessionRoleApplication
UISceneConfigurationName
Default Configuration
UISceneDelegateClassName
$(PRODUCT_MODULE_NAME).CarPlaySceneDelegate
In AppDelegate I have the below
func application(_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions) -> UISceneConfiguration {
if connectingSceneSession.role == .carTemplateApplication {
let sceneConfiguration = UISceneConfiguration(name: "CarPlay Scene", sessionRole: connectingSceneSession.role)
sceneConfiguration.delegateClass = CarPlaySceneDelegate.self
return sceneConfiguration
}
// Configuration for other types of scenes
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
Why am I getting the exception? Kindly suggest
In Carplay, is it possible to update the navigation title and also add right tab bar items? Couldn't find these details in the documentation. Please suggest