Section collapse triangle for section header no longer supported with NavigationStack?

Since NavigationView is now deprecated, I’m trying to update my code to use NavigationStack instead. However, I found that when using NavigationStack, section headers within an overall List view no longer have the collapsing triangle functionality. This used to work for NavigationView, List view, Section headers. Am I missing something? Is there a way to get back the section header collapse triangle within an overall List view when encapsulating within a NavigationStack?

Answered by BabyJ in 755576022

You are correct in that you have to use the new initialisers with the isExpanded parameter to enable the expansion of sections. However, as of iOS 17 beta 1, this only works for lists with the sidebar style. Having spoken with an Apple engineer, it was agreed that this is not the intended behaviour and all list styles should have expandable sections. I did file a feedback report (FB12277169) so this should be resolved soon.

Upon further reading...it appears that the default for Section headers going forward will be to NOT show expansion arrows. To use expansion arrows, a new isExpanded parameter needs to be included in the Section initializer and will be needed to bind to a state property. I haven't gotten this new approach to work, but seems like the answer.

Accepted Answer

You are correct in that you have to use the new initialisers with the isExpanded parameter to enable the expansion of sections. However, as of iOS 17 beta 1, this only works for lists with the sidebar style. Having spoken with an Apple engineer, it was agreed that this is not the intended behaviour and all list styles should have expandable sections. I did file a feedback report (FB12277169) so this should be resolved soon.

I think that’s only for Apple to see

Correct. My Bug Reporting: How and Why? post explains this and also offers some options.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Section collapse triangle for section header no longer supported with NavigationStack?
 
 
Q