admin管理员组

文章数量:1123190

I did some searching but didn't understand the answer and I hope, I can ask the question again and get some help to find a solution.

I have a LazyVGrid with a NavigationLink inside and I would like to do that.

@State private var trainings = [TrainingData]()

LazyVGrid(columns: columns, spacing: columnVSpace) {
                        
    ForEach(trainings, id: \.id) {training in
    
        NavigationLink(value: training) {
        
            TrainingItemViewiPad(training: $training, trainings: $trainings) // => here is the issue, please see screenshot
        }
    }
}

struct TrainingItemViewiPad: View {
    
   @Binding var training: TrainingData
   @Binding var trainings: [TrainingData]

}

Here is my navigationDestination with the same issue.

.navigationDestination(for: TrainingData.self) { training in
    TrainingDetailViewiPad(training: $training, trainings: $trainings) // => here is the issue, please see screenshot
}

struct TrainingDetailViewiPad: View {
    
    @Binding var training: TrainingData

}

Is there a way to use Binding as shown?

Many thanks advance, Sven

本文标签: