Post

Replies

Boosts

Views

Activity

Reply to SwiftUI NavigationLink in List on iOS 14
This is definitely a bug in List, for now, my work-around is refreshing the List by changing the id, like this: struct YourView: View { 		@State private var selectedItem: String? 		@State private var listViewId = UUID() 		var body: some View { 						List(items, id: \.id) { 								NavigationLink(destination: Text($0.id), 															 tag: $0.id, 															 selection: $selectedItem) { 									Text("Row \($0.id)") 								} 						} 						.id(listViewId) 						.onAppear { 								if selectedItem != nil { 										selectedItem = nil 										listViewId = UUID() 								} 						} 		} }
Jan ’21