I want make a function which make my typing easier when I must initialize a Binding in some cases!
Here is the code:
func bindingFunction(value: inout CGFloat) -> Binding<CGFloat> {
return Binding(get: { return value }, set: { newValue in value = newValue })
}
I am getting 2 errors from xCode:
- Parameter 'value' is declared 'inout'
Escaping closure captures 'inout' parameter 'value'
My Goal is to solve those errors in first place and finally I want make my function be generic as well, as you see my function works for Binding CGFloat which I want make it generic and then I could use it when I need Binding Bool as well.