1. 4
  1. 3

    SwiftUI relies on several edge features of the Swift language, notably the view builder DSL. That makes the SwiftUI view you get in a new app template a poor introduction to the language, with worse error messages than elsewhere. But SwiftUI is the very fastest way to get started and see something tangible. Once you’ve followed tutorials enough to want the formal tour, I suggest the language book hosted at swift.org. It is a big language by now and there is a lot to love if you spend the time. WWDC videos go deep as well; I recommend the intro to Xcode for starters.

    1. 1

      Sometimes I think we don’t go far enough with the declarative part of UI frameworks. For example, the WinForms comparison myNewForm.Show(), that’s modifying some state variable hidden in the framework. At least in the Swift code here, that variable is clearly visible!

      But SwiftUI does have a lot of magic annotations and pitfalls to go along with them. Much like React hooks. Svelte probably does the best job of hiding this from the user (from what I’ve seen).

      I’m not sure what to think of the syntax magic in Swift. Not necessarily the getter syntax or inferred types (some) OP is talking about, but view builders. Those seem like really stretching it.

      Compared to web frameworks, though, at least you’re not writing 3 different languages to be productive. That has to count for something.

      1. 1

        Learning SwiftUI by trial and error is going to be a painful experience when you’re coming from a “traditional GUI” background… I’d read at least a few tutorials to help switch into a declarative mindset.