reshadf
(Reshad Farid)
1
Using the below example, if you scroll all the way down the onAppear seems to not trigger. Or it does sometimes occasionally but very inconsistent. As soon as I remove the listStyle modifier everything works as expected. Am I doing anything wrong here, or is this a swiftUI bug?
struct ContentView: View {
@State var listOfItems = Array(0...100)
var body: some View {
List {
ForEach(listOfItems, id: \.self) { item in
Text("\(item)")
}
Text("Hello, world!")
.onAppear {
print("I appeared")
}
}
.listStyle(PlainListStyle())
}
}
waliid
(Walid)
2
Hello @reshadf,
Your code seems to be correct.
Which version of Xcode/Swift are you using?
reshadf
(Reshad Farid)
3
I am using the latest version of xcode and swift.
waliid
(Walid)
4
Are you running the code into the playground or in a project?
reshadf
(Reshad Farid)
5
in a project. You can literally copy and paste my example code.
@reshadf I just tried out the code block, you're right but it does work with the .listStyle(.insetGrouped). It doesn't show the I appeared message for the rest of the list styles. Probably a bug I guess.