3 ms·
Are Swift and SwiftUI different languages? I naively assumed SwiftUI was just a library to create and render UI components, but I’m not familiar with iOS/macOS
by dgellow 5y ago
Are Swift and SwiftUI different languages? I naively assumed SwiftUI was just a library to create and render UI components, but I’m not familiar with iOS/macOS development. Just surprised to see a distinction between the two in the article.
- vlozko 5y agoYou’re correct in that SwiftUI is just another library built on top of Swift. SwiftUI heavily takes advantage of a relatively new Swift feature: result builders. So while SwiftUI code is technically Swift code, at times it does feel like a different language as control flow operates differently.
- randomNumber7 5y agoAll the @State, @Published etc. pragmas look to me like they hacked the compiler to do the stuff they couldn't do in a regular library....
- viktorcode 5y agoThose are just property wrappers; another feature of the language accessible to everyone.
- b3morales 5y agoIncorrect. The SwiftUI property wrappers, most notably @State, use internal knowledge and non-public reflection. They are not stably implementable by outsiders.
- bsaul 5y agoswiftui is the latest UI framework for building user interface. it's not a language. However it uses a lot of swift constructs that makes it feel like a Domain Specific Language to describe UIs (like html).