简素开发
简素开发

Reputation: 11

Swiftui List Row Dynamic Height

I have a question about List Row Dynamic in SwiftUI; how reset height of row when EditMode of List changed, For now, ui element of Row has changed, but height of row in the list not update to fit.

inactive editmode

active editmode

anyone know how to fix it? thanks

Upvotes: 1

Views: 4920

Answers (1)

Raja Kishan
Raja Kishan

Reputation: 18924

Use .fixedSize. Example

List {
    ForEach(users, id: \.self) { user in
        //Your list row view
          .fixedSize(horizontal: false, vertical: true) // <-- Here
    }
    .onDelete(perform: delete)
}

Upvotes: 4

Related Questions