Strengths and Limitations of SwiftUI

by

SwiftUI is a development implementation framework made by Apple. Version 1.0 was released in 2019 to replace their previous UIKit software, and it has been rapidly evolving with new features each year since then. It is an exceptional leap in user interface development for Apple products because it offers ease of development, cross-platform configuration, and robustness.

Strengths

Ease Of Development

SwiftUI makes Apple application development simple and easy so that more people can create them. The system of coding is declarative, meaning that you describe what you want to see. This is both an easier and more efficient system than the alternative, imperative coding, which requires you to have more advanced knowledge to write code about how you want each action to occur. 

Cross-Platform Code

An outcome of this code simplification is that SwiftUI handles the layout for you – making it much faster for new developers to make apps that look and feel like Apple apps are expected to. With SwiftUI, you simply write one piece of code that the software will then configure to any Apple device screen the application is running on. For example, an application that uses slider bars will have them appear in appropriately placed positions in the layout for any Apple device screen without any additional input from the developer.

While coding, you can also switch between Apple screen configurations to see exactly how the layout appears on each of them, and even compare screen types by looking at them simultaneously. This is a valuable feature to easily craft an application while getting real-time feedback on the appearance as you code.

Application Robustness

SwiftUI provides what is known as a single source of truth, meaning there is only one screen definition which solves the challenge of complex update coordination. In the past, a developer would have had to implement multi-stage routines and device-specific updates to refresh applications. Now, SwiftUI is capable of handling all of that, minimizing human error in the update process.

Limitations

Operating System Version

Although SwiftUI includes exciting new features in each release, you can only run those functions if you meet the operating system (OS) requirements for the current SwiftUI version. The minimum supported OS versions for each SwiftUI release are:

  • SwiftUI 1.0 2019: Xcode 11 – iOS 13 / iPadOS 12 / MacOS 10.15
  • SwiftUI 2.0 2020: Xcode 12 – iOS 14 / iPadOS 13 / MacOS 11
  • SwiftUI 3.0 2021: Xcode 13 – iOS 15 / iPadOS 14 / MacOS 12

Unfortunately, this means that if you need to develop an app that is supported on iOS 12, you won’t be able to use SwiftUI. 

Adherence To Human Interface Guidelines

Apple accepts some popular applications that do not adhere to the Human Interface Guidelines, which generally ensure that applications are consistent and user-friendly. As part of this, sometimes SwiftUI will choose to do things in ways that are contrary to these guidelines, causing you to wrestle and tweak the system at times to follow them.

Screen Flow Control and Interruption Responses

If you need to tightly control screen flow in your application, you will have to specifically define the screen size so that SwiftUI doesn’t make assumptions that work against you. Similarly, for interruption-driven actions – such as a messaging app receiving a new video notification that will open and play within the same screen – you must ensure that the screen the notification is received on is capable of integrating the video. This can be tricky!

Forget Pixel-Perfect Layouts

Designers that prefer pixel-perfect layouts tend to struggle with SwiftUI since it doesn’t provide that level of precise control. Because SwiftUI prioritizes ease of development, it handles the general layout for you. If you try to over-control the design, it will not allow the application to perform adequately across all screen layouts – defeating the main purpose that SwiftUI is designed for. For example, you might be able to manipulate the layout to look perfect on the iPhone screen, but the translation to any other Apple screen type will appear distorted.

Resources

A few resources that are especially useful for those wanting to learn more about Swift UI are:

WWDC20 Introduction to Swift UI

https://developer.apple.com/videos/play/wwdc2020/10119/

Hacking with Swift: SwiftUI Tutorial

https://www.hackingwithswift.com/quick-start/swiftui/swiftui-tutorial-building-a-complete-project

Apple SwiftUI Sample Apps

https://developer.apple.com/tutorials/sample-apps

1 Comment

  1. Anan on said:

    Good post. It seems very helpful.

Leave a Reply

Your email address will not be published. Required fields are marked