How to use custom image for reorder control in SwiftUI

Viewed 94

How can I use my custom image for reorder indicator in List?

Currently I'm trying solution

struct TestView: View {
@State private var users = ["Paul", "Taylor", "Adele"]

init() {
    UITableViewCell.appearance().editingAccessoryView = UIImageView(image: UIImage(systemName: "checkmark")) 
    //What I'm actually using to achieve custom icon
}

    var body: some View {
        NavigationView {
            List {
                ForEach(users, id: \.self) { user in
                    Text(user)
                }
                .onMove(perform: move)
            }
            .toolbar {
                EditButton()
            }
        }
    }

    func move(from source: IndexSet, to destination: Int) {
        users.move(fromOffsets: source, toOffset: destination)
    }
}

But as a result - on switching to editing mode app is freezing and memory consumption grows grammatically. I see some solutions for UIKit, but I need for SwiftUI

0 Answers
Related