'Changing Foreground colour of a SwipeAction Label in SwiftUI

I'm creating a SwiftUI application targeted for iOS 15+ that requires the use of .swipeActions(_:) One thing I noticed was that whenever I added a .foregroundColor(_:) to change the Swipe Action Label colour, it doesn't get applied. Does anyone know how I can override the label colour to provided colour? TIA.

My code to reproduce my problem (Keep in mind my minimum deployment target is iOS 15):

struct SecondView: View {
    var body: some View {
        VStack {
            List {
                ForEach(1..<Contact.contacts.endIndex) { index in
                        Text("Cell number \(index)")
                        .padding(40)
                    }
                    .swipeActions(edge: .leading) {
                        Button {
                            // Do something
                        } label: {
                            Label(title: {
                                Text("Left Swipe")
                                    .foregroundColor(.black) // <--- Doesnt Work
                            }, icon: {
                                Image(systemName: "pin")
                                    .foregroundColor(.black)  // <--- Doesnt Work
                            })
                        }
//                        .foregroundColor(.black)  // <--- Doesnt Work
                        .tint(.gray)
//                        .foregroundColor(.black)  // <--- Doesnt Work
                    }
                    .swipeActions(edge: .trailing) {
                        Button {
                            // Do something
                        } label: {
                            Label("Delete", systemImage: "trash")
                                .foregroundColor(.white)
                        }
                        .tint(.red)
                    }
                }
            }
            .listStyle(GroupedListStyle())
        }
    }


struct SecondView_Previews: PreviewProvider {
    static var previews: some View {
        SecondView()
    }
}

I have added comments to all the .foregroundColor()'s that don't work and have commented out a few of them.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source