Instead you need to silo your changes, so your entire App isn't redrawn every frame. This means any view with a reference to the ObservableObject gets re-rendered when values change. Regarding the performance issues of this specific post, my guess is they put everything into an ObservableObject, and used properties to get bindings for their UI controls. Switching mental models like that, and trying to remember all the intricacies of both SwiftUI and AppKit is rough. menu, and other stuff, which makes things much more complicated for me, and forces me to think about both SwiftUI/AppKit. I just got done refactoring a huge amount of my app to use the "AppKit App Lifecycle" instead of the SwiftUI App lifecycle since I need some specific windowing behavior. And the area where AppKit/SwiftUI meet will disappoint and frustrate you. But you will run into things you can't do, forcing you have to fall back to AppKit/UIKit. SwiftUI has enabled me to build out huge amounts of beautiful UI quickly – faster than anything I've ever used. If you look at SwiftUI examples/code, most of the complexity is hidden, but it's there, and you're going to have to interact with it to do anything non-trivial. It's going to take you at least a year to get used to the declarative way it works, and be able to make UIs without struggling to figure out how to shuffle data around. I'm building an IDE in (mostly) SwiftUI, and have been using it since release, so I feel like I've worked with it more than most people.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |