ios – Modify form shade inside customized ButtonStyle


In my venture, I’m utilizing my customized form as a button’s label. Now, I’m making an attempt to create a customized ButtonStyle which modifications the customized form’s shade each time a button is at the moment pressed.

If I have been to make use of a “regular” Button label, e.g. a Textual content, I might do that:

struct LightGrayButtonStyle: ButtonStyle {
    func makeBody(configuration: Self.Configuration) -> some View {
            .foregroundColor(configuration.isPressed ? .black : .pink)

Nonetheless, configuration.label doesn’t have any Form particular view modifiers, making it unattainable to change the colour utilizing .fill for instance.

That is the remainder of my code:

Button {
} label: {
   RingSegment() // that is my customized form
.buttonStyle(LightGrayButtonStyle()) // I apply my customized button fashion

How can I now change the colour of my customized form inside my customized ButtonStyle? Alternatively, how can I make my customized form respect the supplied foregroundColor which I can set contained in the makeBody technique carried out by my LightGrayButtonStyle?