swiftui stumbling blocksJan. 24, 2021 107 words 1 min
As mentioned in retro 2020, I am currently rewriting Yafra and SwiftUI is a mixed bag. After wrapping my head around
@ObservableObject and its siblings, there was quick progress and I like the idea of having only a single source of truth. But there are still a lot of rough edges in SwiftUI. Like misleading or plain wrong documentation. A TextField should accept a binding to any type, like this:
TextField("default",value: $binding,formatter:NumberFormatter). The code compiles, doesn’t crash at runtime, but fails to update the binding. Took me while to read on Stackoverflow that it does not work although the documentation lists a similar implementation as an example.