NEW: Learn to build the incredible iOS 15 Weather app today! >>

Issues with List Section Headers in iOS 15...

Forums > SwiftUI

Is anyone having issues with iOS/iPadOS 15 showing Section Headers in lists with propper vertical spacing? When I slide the view with the list up from the bottom, the first Section Header overwrites the things in the list, but when I slide the view over from the side, everything is spaced correctly. Of course, this only started with iOS 15 and Xcode 13 when I upgraded everything yesterday. :)

View slid from bottom (it only affects the first Section Heading):

View slid from the side:

Here's a video of it all in motion, if that helps.

My question is whether anyone knows if there's anyway to correct this behavior, or if anyone has any tips on what I can try to make it work better. The app is already in the app store, so I guess it'll just be spacing issues for anyone who upgrades to iOS 15 until I figure it out.

The code is this:

Section(header: Text("Choose a Palette")) {
    VStack {
        LazyVGrid(columns: paletteColumns) {
            ForEach(localBalloonsArrayOfStringsPalettes, id: \.self, content: twoColorPaletteButton)
        }
        .padding(.vertical)
    }
}

   

Is this only on simulator or on a real device, too? Just asking, because I wasted hours searching for a bug in my code which only happened on simulator, not on a real device.

   

it happens on my M1 iPad Pro as well. I haven't checked it on other devices.

   

I've experienced something similar in a different context, and what I took away from it was that SwiftUI was detecting a change in data and animating the change between the two.

Two things that I would try:

  1. adding a .animation(.none) to the things you don't want to have animate
  2. adding a .id(UUID()) to the relevant view so that SwiftUI interprets it as a whole new view instead of a change within a given view

   

Hacking with Swift is sponsored by Sentry

SPONSORED With Sentry’s error and performance monitoring for iOS, you see mobile vitals that actually matter, can solve any latency issues quickly, and learn how each release is performing over time.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.