I have list item, and all item destination view routed to EndView, how can I add multiple destination view for every item, for example: when I click the first item it will open EndView, when I click the second item it will open NewView...., any idea will be appreciated.
Option:
InnerView:
Option:
Code Block struct InnerOptionValues: Codable { var title: String var image: String var isAddSection: Bool var isUseToggle: Bool var headerTitle: String } extension Option { static let listValues: [InnerOptionValues] = [ .init(title: "title1", image: "image1", isAddSection: true, isUseToggle: false, headerTitle: ""), .init(title: "title2",image: "image2", isAddSection: false, isUseToggle: false, headerTitle: ""), .init(title: "title3", image: "image3", isAddSection: false, isUseToggle: false, headerTitle: ""), .init(title: "4", image: "image4", isAddSection: false, isUseToggle: false, headerTitle: ""), .init(title: "5", image: "image5", isAddSection: false, isUseToggle: false, headerTitle: ""), ]
InnerView:
Code Block struct InnerView: View { let value: InnerOptionValues var body: some View { return NavigationLink(destination: EndView(value: value)) { HStack { Image(value.image) .resizable() .frame(width: 16, height: 16) .aspectRatio(contentMode: .fill) Text(value.title) .foregroundColor(.blue) .font(.system(size: 18)) } } } } struct EndView: View { let value: InnerOptionValues var body: some View { return NavigationLink(destination: EndView(value: value)) { Text("Coming Soon!!!") .font(.system(size: 25)) .foregroundColor(.blue) } .navigationBarTitle(Text(value.title), displayMode: .inline) } }