I want to make my List inside a ScrollView so that I can scroll List rows and headers together.
But I found that List inside ScrollView isn't working. It shows nothing.
I should use both of them.
- I should use ScrollView so that I can make my header(image or text) also scrolled when I scroll the rows.
- I should use List to use .ondelete()method.
my sample code is below.
@State private var numbers = [1,2,3,4,5,6,7,8,9]
var body: some View {
    ScrollView {
        Text("header")
        List {
            ForEach(numbers, id: \.self) {
                Text("\($0)")
            }
            .onDelete { index in
                // delete item
            }
        }
    }
}
Anyone know why this happens and(or) how to fix?
 
     
    
 
     
    
 
    