4 Comments

While I find lots of articles on init() for classes, I continue to see them in use for Views and virtually no advice/articles on why, how to use, or customize them for complex views. I see tutorials that use them but without a lot of explanation as to what is really going on or the meaning of the various piece of the definitions. The last time I really saw advanced init files was for mainframe programming...early 90's.

Expand full comment

Thanks for this Ken! This is one of the topics in my backlog so moving it right up. I agree, there’s a lot to init with SwiftUI, and often it’s because it’s revealing something about how SwiftUI is working under the hood. Pumped to dive into this more!

Expand full comment

Thanks much. I am working on a complex SwiftData App that really needs to be on Oracle and have found that the init file is a good way of getting related info to the view. So the more info on the subject that you can produce, the better IMHO

Expand full comment

Hey Ken! Just published a new article on initializers! I covered a lot of the more common use cases and didn’t get into SwiftData, specifically. But this got SUPER lengthy just with the common areas so I am working on a follow-up that focuses more on SwiftData. In the meantime, hope you like the post!

Expand full comment