SwiftUI List Edit mode change properties such as button color

Viewed 289

In swiftUI I have a list which enables to be edited through .editMode. The only problem is that i would like to change the edit button's position and color, in order for it to be on the right. This is because right now, using my custom layout it can't be seen.

Edit: This is how i make my list and call for edit

struct testView: View {
    @State var isListEditing = false
    
    var body: some View {
        List {
            ForEach(Array(array.enumerated()), id: \.element.id) {index, element in
                Text(element)
            }
            .onMove { (source: IndexSet, destination: Int) -> Void in
                self.array.move(fromOffsets: source, toOffset: destination)
            }
            .onLongPressGesture {
                withAnimation {
                    self.isListEditing = true
                }
            }
        }
        .environment(\.editMode, isListEditing ? .constant(.active) : .constant(.inactive))
    }
}

Button can't be seen

Thanks for the help!

0 Answers
Related