Unrelated addendum: The author should look at the drawingGroup API. This could significantly speed up the drawing of the month grids on refresh by caching the resulting rasterized view instead of repeatedly redrawing it.
Unrelated addendum: The author should look at the drawingGroup API. This could significantly speed up the drawing of the month grids on refresh by caching the resulting rasterized view instead of repeatedly redrawing it.
Say whatever you want about modern web development, but I think React/JSX + HTML/CSS has proven you can use a declarative model to build complex user interfaces.
Take on the other hand, some of SwiftUI's more advanced features, like PreferenceKey which are extremely under-documented (the generic sounding name doesn't help either). Of course folks are going to struggle to do more complex things.
I wonder how much the situation would be helped if the thing you searched for help allowed in-line SwiftUI examples, like you can do on the web. Playgrounds is kind of that thing but you aren't searching a repository of playgrounds for documentation.
Watch this talk from one of the core developers about the design https://www.youtube.com/watch?v=dkyY9WCGMi0
In fact, Dart doesn't even support closed source.
Browser-based web apps are basically punching above their weight class. Compared to the power of native UI's, the browser is broken. React understood this and created two innovations:
1. The Virtual DOM
2. The reactive UI
Now, I'm no expert, but Number 1 seems like a terrific idea; and Number 2 seems like it's needed in order to implement Number 1.But, to my thinking, a reactive UI is a big problem of leaky abstractions, which is what I think you're saying.
To me, iOS/macOS UI development needed neither the baby nor the dirty bathwater. I feel like the whole thing is a mistake. As a programmer, I want control over updating the UI.
VDom is one of those arguable things, plenty of frameworks are faster than React w/o a vdom, and some frameworks are faster than React and also use a VDom.
[1] Arguably react is not even that reactive, you have to manually wire up everything yourself.
SwiftUI is nice for small apps and demos. But as soon as you add persistence, or try and do anything advanced the complexity balloons and you need to understand it completely. I think SwiftUI is just a bad abstraction with a lot of accidental complexity. It makes drawing much easier/faster for developers but all the state management stuff has become very difficult.
I do agree that ObservableObject/@Published should have been designed to prevent unnecessary re-renders. It's actually quite easy, and I expect Apple will include this in the future: Add an extension to @Published when the value type is Equatable and only send objectWillChange() when newValue != oldValue. I do something like this in my apps to eliminate superfluous re-renders, but the implementation is non-trivial due to an undocumented feature in Swift [0].
[0] https://github.com/apple/swift-evolution/blob/main/proposals...
So this is much better than Swift.
> This in itself is an interesting anecdote about documentation quality.
apple used to make these great deep-dive pdfs for new frameworks like core data, quartz (core graphics), even obj-c itself that explained many nuances and caveats of each subsystem/framework...imho i think swiftui could use a good doc like that
Those were so awesome because they explained the whole system. The core graphics one was an absolute lifesaver when I started working with iOS. Apples UI a frameworks seemed way more complex than anything I’d ever worked with before but once I understood the layers they started to click. I don’t know what I would have done with a bunch of class guides with patchy comments.