Apple launched its Swift programming language almost five years ago. It was designed to supplant Objective-C with something that’s powerful, expressive, and crucially, as easy for beginners to grasp as Python. While it largely succeeded, one hindrance was the underlying MacOS and iOS APIs, which weren’t nearly as intuitive.
Enter SwiftUI, which is Apple’s newest UI framework.
SwiftUI is available across all of Apple’s menagerie of devices: phones, tablets, TV boxes, watches, and computers. It allows developers to create UI elements with an expressive, simple declarative syntax. Crucially, this can be done without writing mountains of code.
— Jack Lawrence (@_jackhl) June 3, 2019
Demonstrating the framework on stage, Josh Shaffer, an Apple software developer, showed how a basic ‘Hello World’ iPhone app can be created with just six lines of code (and two of those were closing curly braces).
Alongside SwiftUI is a brand new Xcode interactive development experience. Just like Swift Playgrounds, developers can see changes reflected in real-time, as the IDE automatically refreshes. It also comes with a Google Chrome-style inspect tool, allowing developers to select specific elements from within the emulator and modify them through a drop-down graphical interface. Any changes made within the emulator are automatically reflected within Xcode’s text editor.
The framework also allows developers to drag-and-drop elements into their app. Xcode will automatically generate code for these elements.
— Ken Yeung (@thekenyeung) June 3, 2019
Given the focus of SwiftUI is centered on maximizing developer productivity, it’s no surprise that the framework comes with support for several OS-level features baked-in, like the “dark mode” that’s now available on iOS, or support for right-to-left languages like Arabic and Hebrew.