UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

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)
    }
}

3      

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.

3      

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

3      

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

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

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

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

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.