# \[SwiftUI\] Binding\<String\> in AF Request URL

**URL:** <https://forums.swift.org/t/swiftui-binding-string-in-af-request-url/52498>\
**Category:** Using Swift\
**Tags:** string, string-interpolation, bindings, async-request\
**Created:** [September 30, 2021, 8:22pm UTC](https://forums.swift.org/t/swiftui-binding-string-in-af-request-url/52498 "2021-09-30T20:22:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jannis6023](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jannis6023/32/19529_2.png) [@Jannis6023](https://forums.swift.org/u/Jannis6023)\
**Post date:** [September 30, 2021, 8:22pm UTC](https://forums.swift.org/t/swiftui-binding-string-in-af-request-url/52498/1 "2021-09-30T20:22:41Z")

</div>

Hi together,  
i have a Binding in my SwiftUI View. It looks like this:

```swift
struct ContentView: View {
    var body: some View {
        let binding = Binding<String>(get: { () -> String in
            return String(format: "%.2f", self.model.value)
        }) { (s) in
            var s = s
            s.removeAll { (c) -> Bool in
                !c.isNumber
            }
            self.model.txt = s
        }
        VStack{
            TextField("Amount", text: binding)
            Button(action: {
                loading = true
                
                AF.request("https://example.com/\(binding)", method: .get)
                    .responseString{response in
                        // ...
                    }
            }){
                Text("Go")
            }
        }
    }
}

```

But I can't use the binding in my Interpolation - it crashes instantly when this AF Request code runs!  
Can I "refactor" the binding to a default var?

Can anyone help me?

Thanks!

---

<div class="post-metadata">

**Author:** ![Peter-Schorn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/peter-schorn/32/11183_2.png) [@Peter-Schorn](https://forums.swift.org/u/Peter-Schorn)\
**Post date:** [September 30, 2021, 8:31pm UTC](https://forums.swift.org/t/swiftui-binding-string-in-af-request-url/52498/2 "2021-09-30T20:31:57Z")

</div>

The type of `binding` is `Binding<String>`. What you want in the string interpolation is the wrapped value of the binding, which is of type `String`:

```swift
AF.request("https://example.com/\(binding.wrappedValue)", method: .get)

```
