SwiftUI avoid custom binding for view performance
The problem
In SwiftUI, when the view is redrawn, the SwiftUI compares which of the bindings has changed. As long as you use a keypath binding, the SwiftUI is able to compare the binding if it has changed or not.
Solution
For view drawing performance boost, avoid making a custom bindings like the below one:
private var myString: String = "" 
//...
let binding = Binding {
                    myString
                } set: {
                    myString = newValue
                }
DatePicker("Custom Date", selection: binding)
That’s all for today! Thanks for reading.