List in swiftui locking up

If I run this code below , it will goto the detail view the first time, but will not goto the detail view again. It locks up the program with no errors.

If I add a second item in the first List (0..<2) it runs fine. Any ideas ?


Xcode 11.3


import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
List {
NavigationLink(destination: DetailView() .navigationBarTitle("Test Detail")){
Text("Goto Detail").foregroundColor(.blue)
}
.navigationBarTitle("Welcome")
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
struct DetailView: View {
var body: some View {
List(0 ..< 5) { item in
Text("hello").foregroundColor(.blue)
}
}
}
Answered by Claude31 in 401331022

I noticed the problem with List.


When you have selected an item and activated the link, typing the same selection does not refire the link.


If I add a second item in the first List (0..<2) it runs fine. Any ideas ?

I suppose it works if you select the other item.


Note: rotate the device, drag the left panel of the navigation and do selection, it will be more clear what happens.


Note: it is a bug, corrected in iOS 13.3.ß4.

https://forums.developer.apple.com/message/395130

or

https://stackoverflow.com/questions/59061298/cant-select-same-row-twice-in-swiftui

Accepted Answer

I noticed the problem with List.


When you have selected an item and activated the link, typing the same selection does not refire the link.


If I add a second item in the first List (0..<2) it runs fine. Any ideas ?

I suppose it works if you select the other item.


Note: rotate the device, drag the left panel of the navigation and do selection, it will be more clear what happens.


Note: it is a bug, corrected in iOS 13.3.ß4.

https://forums.developer.apple.com/message/395130

or

https://stackoverflow.com/questions/59061298/cant-select-same-row-twice-in-swiftui

it works on the device , but not on the simulator or xcode editor.

List in swiftui locking up
 
 
Q