Post

Replies

Boosts

Views

Activity

Reply to SwiftUI onAppear called inconsistently based on the presence of listStyle
I'm aware this is an old topic but I am also facing this situation today (2024). That's too bad that the .onAppear() does not behave as the name implies. I understand that the behaviours between SwiftUI and UIKit are not quite the same (UIKit version viewDidAppear / viewWillAppear will always be called when a view will be facing to the user, that's because UIKit manipulates class instances VS SwiftUI which uses structs, so the view hierarchy will not be changed in some cases), but I think the name .onAppear() should be changed to something more descriptive (e.g. onViewAttached or onViewHierarchyChanged)
1d