NEW: My new book Pro SwiftUI is out now – level up your SwiftUI skills 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)
    }
}

1      

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.

1      

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

1      

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

1      

Hacking with Swift is sponsored by Play

SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!

Click to learn more about Play!

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.