Using SwiftUI how can I get the click of a "Button" to change the wording of a "Label" and/or "Text" Field?
I have tried:-
let myLabel = Label {
Text("Text to be Changed"
.foregrorundStyle ......
} icon: {
......
}
....
.....
Button("Change Label Wording"){
myLabel.stringValue = "Changed text"
}
This gives me two problems (at least):
- I cannot get the label to display
- The
myLabel.stringValue = "Changed text
gives me the error:
- Type '()' cannot conform to 'View'
- Value of type 'Label<some View, some View>' has no member 'stringValue'
What have I done wrong?