listRowSpacing support section

listRowSpacing only support the whole List, but sometimes we want to apply different spacing for different section in List.

Hi @zacJI ,

Please file a feedback assistant enhancement report through this at https://feedbackassistant.apple.com since, as you mentioned, this modifier doesn't have the functionality for that. One workaround I found is to use a ScrollView that contains a VStack which has two Lists within it. Then, you can apply different spacings to them.

var body: some View {
        NavigationStack {
            ScrollView {
                VStack (spacing: 0) {
                    List {
                        Section("A") {
                            ForEach(0..<5) { num in
                                Text(num.description)
                            }
                        }
                    }
                    .listRowSpacing(10)
                    .frame(height: 350 )
                    List {
                        Section("B") {
                            ForEach(0..<3) { num in
                                Text(num.description)
                            }
                        }
                    }
                    .frame(height: 300)
                    .listRowSpacing(40)
                }
            }
        }
    }
listRowSpacing support section
 
 
Q