4

I have the following structure, more or less:

ZStack {
    NavigationView {
        List {
            Section(header: Text("1")
                                .padding(.top, 20)
                    footer: Text("2")
                                .padding(.bottom, 20)
                    },
                    ...
        }
        .listStyle(GroupedListStyle())
    }
}

For iOS 14 and earlier it was working properly, but in Xcode 13 beta 4/5, when running iOS 15, the padding is much bigger, as if there was a default padding added. I need to replace my values (20 in this example) with 0 in order to match the design.

Has anyone experienced such issue? Any solutions?

Fengson
  • 4,751
  • 8
  • 37
  • 62
  • 1
    They changed the default design of List, just make your custom paddings conditional on system version availability. – Asperi Sep 09 '21 at 07:43

2 Answers2

1

The only solution that seems to work for me is this:

List { ... }    
    .onAppear(perform: {
        UITableView.appearance().contentInset.top = -35
    })

-35 will remove almost all of the spacing, -30 is more like the spacing that was in iOS 14.

cseh_17
  • 194
  • 2
  • 10
0

The same thing happened to me. You just have to delete your DerivedData folder. You don't need to take make any changes to your code. Took me a while to figure that out.

Arturo Lee
  • 61
  • 1
  • 8