I am probably missing something but I can't make the NavigationLink work inside a List.
I'm using NavigationLink(destination, tag, selection) And i would like to pop to the root view with a tap on a button as you can see in this sample project:
		@State var selectedView : Int? = nil var colors : [String]		= ["blue", "yellow", "green", "red", "black"]
		var body : some View {
				NavigationView {
						List {
								ForEach (colors.indices)
								{
										index in NavigationLink (
												destination : ColorDetail (
														selectedView : self.$selectedView,
														color : colors [index]
												),
												tag : index,
												selection : self.$selectedView,
												label : {														 Text(colors[index])												 }
										)
								}
						}
				}
		}
}
struct ColorDetail : View {
		@Binding var selectedView : Int? var color : String var body : some View {
				VStack {
						Text (color)
						Text ("SelectedView: \(selectedView ?? 99)")
						Button ("set SelectedView to nil and go back")
						{								 self.selectedView = nil						 }
				}
		}
}
Why if I set selectedView to nil nothing happens? How can i pop to the root view (ContentVIew) from the ColorDetail on a button tap?
Just copy this code and try it, it will build.
Post
Replies
Boosts
Views
Activity
Hello,
is it possible to change the account holder of a membership signed as "Company / Organization"?
Is it possible to change the agreements to another member of the account (admin)?
Can a developer account (company / organization) transfer apps to an individual account?
I am trying to grant access to users that subscribe to premium on the iOS app also to users that use the macOS version.
The iOS and macOS version are two separate apps with different BundleIDs, same Team ID.
I can't create a App bundle because they are part of different platforms.
I know that I could ask the user for a login so I could recognize the user from the authentication, but I would like to avoid this step.
Is there any ID i can use to identify users between different platforms?