Swift UI is a user interface framework intended to make it easier to build Apple platform apps in the Swift programming language for mobile development. It was introduced at the annual Worldwide Developers Conference (WWDC) in 2019, alongside many new APIs and frameworks, all intended to grow the base of mobile developers fluent in developing for Apple products. As the Cupertino-based company explained, “Swift UI is an innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift.”
As Apple plans for the next decade, this new UI framework is Apple’s effort to make iOS development more approachable for beginner mobile developers. Though Swift UI is still in its infancy, its potential to shift how Apple apps are developed is so significant that we mobile developers should start to take note of it. Job descriptions requiring Swift UI expertise are likely to appear in the next few years.
Why Is Apple Prioritizing Swift UI?
The Apple App Store of today looks very different from that of 2008 when it was first introduced to the world. With older Apple product models (iPod Touch, first-generation iPad, etc.) still in use today, there are dozens of screen sizes accessing content from today’s App Store. Auto Layout has long been the default Swift system for managing layouts on various screen sizes and orientations. But with so much fragmentation in the device landscape, mobile developers have been asking for a much simpler and more intuitive way of building apps that can scale across all Apple devices. This is why Swift UI has entered the scene, with features including:
Swift UI Features
- Drag-and-drop code creation: Using Swift UI, developers can drag a button or other component from the object library and drop it onto the canvas. Swift UI automatically writes the necessary code. This drag-and-drop method is even applicable to attributes like font weight.
- Vertical-Horizontal-Z Axis Stack: The VHZ stack lets developers create complex designs simply by dragging and dropping elements in orientations either vertical to, horizontal to, or along the Z-axis of other elements. It’s similar to building within rows or columns, with no manual coding required. This is akin to using the Bootstrap library to build complex interfaces for web design.
- Reusable UI components: Once you’ve created layouts in Swift UI, they can be reused throughout your app. For example, if you’ve built an appearance comprised of a photo left-justified with a precise caption design to the right of the image, that component can be reused by extracting a new subview.
- Build across Apple platforms: With Swift UI, Apple’s made it easier to build across Apple platforms like WatchOS, TV OS, and macOS by using the subview components made in one app across other apps.
How Will Swift UI Change Mobile Development?
2019 saw the popularity of declarative programming skyrocket, mostly thanks to the rise of React, one of the most popular front-end frameworks used today. Much of the excitement and expertise React developers have for the framework’s functionality has made its way to the world of mobile development. Other examples include Google’s shiny new cross-platform UI framework, Flutter, as well as the Kotlin-based JetPack Compose. React, Flutter and JetPack Compose all use a declarative style for building UIs and managing state.
With Apple entering Swift UI into the ring, we’re moving further into the declarative world for mobile development. Hopefully, with continued investment and development into Swift UI, it will become a more enjoyable way of creating iOS apps and adopted by the next generation of iOS developers. I believe the simpler syntax and more straightforward state management will encourage more people to pick up Swift and iOS development.
Swift UI vs. Flutter
Flutter is a UI framework developed by Google to build native cross-platform apps using the Dart programming language. It’s been widely embraced by mobile developers and ranked as one of the most loved frameworks in the latest StackOverflow survey. Having taught courses in both Swift UI and Flutter, I’ve seen many similarities between the two.
These similarities include the use of a declarative style of programming, easily customizable components, and simple implementation of animations. However, those similarities end when it comes to platform use. Flutter is used to create native cross-platform apps. A developer can use Flutter to build Android apps, iOS apps, web apps, and even desktop apps for Linux, Windows, and Mac. Swift UI, though, can only be used for apps in the Apple ecosystem.
What Does Swift UI Mean for My Current Skills?
Does Swift UI mean that your existing knowledge of Swift is irrelevant? Not at all! Swift UI is currently only supported on devices running iOS 13 or later. It won’t serve as the primary tool in your tool belt just yet.
Apple likes to take things gradually, which we saw in the transition from Objective-C to Swift many years ago. So, UIKit is not phasing out any time soon; your knowledge of the tool is still highly relevant. At WWDC 2019, as Apple unveiled Swift UI, it also introduced new APIs for UIKit. I suspect both UIKit and Swift UI will be developed in parallel. Because UIKit’s been available for so many years, Apple has been able to correct common issues as well as build a wealth of related libraries. These pieces could act as important building blocks in the refinement of Swift UI.
Most companies will still want their apps to support users with iPhones that use iOS 12 and older, so the market for jobs requiring Swift UI expertise hasn’t opened up just yet. Mobile developers of iOS apps will want to continue to demonstrate UIKit knowledge on their resumes and in technical interviews. However, I do expect to see more mobile development job descriptions require Swift UI knowledge in the next two years.
As Swift UI development by Apple and the programming community grows, one thing I always recommend to students is to keep your skills fresh. If you start learning Swift UI now and get familiar with its functionality, it’ll be much easier to keep on top of the framework’s changes later.
Ready to get ahead of the learning curve and start experimenting with Swift UI today? Enroll in my course iOS 13 & Swift 5 – The Complete iOS App Development Bootcamp for the latest in iOS development.
This article was originally posted on Udemy’s Blog: “Why Swift UI Should Be on the Radar of Every Mobile Developer.”