0

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.

Timmy
  • 4,098
  • 2
  • 14
  • 34
nwolfe09
  • 1
  • 3
  • iOS 16 to 17, Xcode 15 beta 6, what a mess of numbers. This rant goes to Apple... Seriously, as a test, if you give iOS16 (instead of 17) as a minimum deployment target in your project, does that change something? – soundflix Aug 24 '23 at 13:24
  • @soundflix - Changing the minimum deployment does not change anything. I provided the version of Xcode beta I'm using, which is 15 beta 6 and simply stated that in iOS 16 this behavior worked. – nwolfe09 Aug 24 '23 at 17:01

0 Answers0