Post

Replies

Boosts

Views

Activity

How to turn a String to a Binding<String>
I'm sorta new to swiftUI, and I don't fully know how stuff like @Binding and @State work, but I have a view that changes a text from a variable passed to the view through:@Binding var str: String A simple example of this would be: struct TextView: View {   @Binding var str: String   var body: some View {     Text($str.wrappedValue)   } } Though when I try to send a string when I call the view it gives me the error: Cannot convert the value of type 'String' to expected argument type 'Binding<String> I have tried to figure out how to turn a String to a Binding<String> but I cant figure it out.
3
0
4.8k
Jan ’21