With a List
embedded in a VStack
, in iOS 16 adding a .listStyle(SidebarListStyle())
would add the collapse/expand buttons to each Section
. Running Xcode 15 beta 6 and the buttons are no longer displayed on each Section. I found the following New Feature in Apple's documentation for SwiftUI, not sure if it's the root cause.
From iOS & iPadOS 17 Beta 6 Release Notes:
Lists using the SidebarListStyle hosted in primary column of a UIKit UISplitNavigationController were previously rendering with an insetGrouped appearance. With this change they will render as the expected sidebar appearance similar to if the List were hosted in a SwiftUI NavigationSplitView. (96909195)
Is there any other listStyle
that will add these collapse/expand buttons back or is this a potential bug in Xcode's beta? Hoping to not make custom section headers.
List {
ForEach(searchResults, id: \.Id) { log in
if log.logs?.count ?? 0 > 0 && vm.filterLogs(logs: log.logs!).count > 0 {
Section(header: Text(vm.getSectionText(log: log))
.font(.title3)
.fontWeight(.bold)
.foregroundColor(.primary),
content: {
ForEach(vm.filterLogs(logs: log.logs!), id: \.Id) { record in
Button(action: {
vm.selectedLog = log
vm.selectedRecord = record
isShowingDetailSheet.toggle()
}, label: {
RecordView(record: record)
})
}
})
}
}
}
.listStyle(SidebarListStyle())
I have tried other listStyle
options, but none of them add the collapse/expand buttons.