BUILD ONCE USE EVERYWHERE

SwiftUI

Apple’s new state driven declarative UI Framework

Navdeep Singh
5 min readOct 29, 2019

--

Apple rocked the iOS world with WWDC 2019 when it announced its new state-driven, declarative UI framework. It is a change for the better and in this article we will introduce the framework and touch up on some of its new component primitives.

Before we get started, many of you might be under the dilemma whether to start learning SwiftUI or broaden UIKit’s knowledge. The answer to that question is simple since many current apps still need to support OS versions below iOS13, it is advised to continue growing your horizons on both the fronts.

iOS13 is the minimum deployment version for SwiftUI.

Transition from traditional UI development to SwiftUI is reasonably smooth even with existing UIKit applications.

Since SwiftUI is fresh out of the beta, expect to encounter some known issues and significant changes to the APIs.

To start building you will need Xcode 11+ and you can download it from developer.apple.com. You will also notice that Xcode 11 supports a new feature called live rendering out of the box. With live rendering you no longer have to build your projects to see the UI on a simulator. But the minimum Mac OS version required version to support live rendering is Mac OS Catalina.

You can install and work with Xcode 11+ on Mac OS Mohave but live rendering will not work in that case.

Swift UI — the framework

In Apple’s words — Swift UI provides an exceptionally simple and fast way to build user interfaces across all Apple platforms with the power of Swift.

It is a framework for creating user interfaces that dramatically reduces the amount of boiler plate code required to create UIs. A good UI experience is built on top of UI components that adjusts to different device sizes and types. Swift UI enables you as a developer to take this experience one notch higher with minimal effort since it provides automatic support for Dynamic Type, Dark Mode, Localization, and Accessibility out of…

--

--

Navdeep Singh

Author of Reactive programming with Swift, Engineering Manager — Exploring possibilities with new Tech.