@binding in swiftui code example
Example: custom binding swiftui
struct ContentView: View {
@State private var username = ""
var body: some View {
let binding = Binding(
get: { self.username },
set: { self.username = $0 }
)
return VStack {
TextField("Enter your name", text: binding)
}
}
}