This content originally appeared on DEV Community and was authored by Mateus Rodrigues
struct ContentView: View {
@State var text = "Lorem Ipsum"
var body: some View {
TextEditor(text: Binding(get: /*() -> Value*/, set: /*(Value) -> Void)*/)
}
}
The get
function will access the text to display it:
func getText() -> String {
return text
}
The set
function will update the text when the user change it:
func setText(_ value: String) {
text = value
}
This content originally appeared on DEV Community and was authored by Mateus Rodrigues