🎉 End-of-year Sale! Save 25% when you subscribe today.
If you have ever created a binding using the get:set:
initializer, you may want to reconsider. Bindings created with this initializer are difficult for SwiftUI to properly track because there is no identifying information associated with them since closures are not Hashable
in Swift. Luckily there is a way to derive bindings that provide identifying information to SwiftUI by using @dynamicMemberLookup
and subscripts.
This is an excerpt from our episode Modern UIKit: UIControl Bindings.
Our free plan includes 1 subscriber-only episode of your choice, access to 64 free episodes with transcripts and code samples, and weekly updates from our newsletter.