Blog

Why you still shouldn't build a business app with SwiftUI

Three years after its introduction, Apple's UI framework is still far from perfect and as such should not be used to build business applications in 2022. In this article, I take a look at backward compatibility, new features and, yes, bugs found in SwiftUI.

In 2019 Apple introduced SwiftUI, a completely new UI framework for developers. It was made to build native user interfaces for apps running all Apple systems: iPadOS, iOS, macOS, tvOS, or even watchOS. In the beginning, the biggest disadvantages of SwiftUI were backward compatibility and immaturity. What has changed in 2022? Not that much.

Table of Content

  1. Backward compatibility is SwiftUI's problem still
  2. SwiftUI is growing old
  3. ...but SwiftUI is still immature
  4. Why you should not build a B2B app with SwiftUi in 2022

Backward compatibility is still a problem

Two years ago I wrote a post explaining the cons of SwiftUI which prevented me from using it in production, at least in business apps. Its main problem was backward compatibility.

SwiftUI is supported only from iOS 13 and higher. In 2019 and 2020 it was a serious problem. How about now?

According to the latest statistics, iOS 15 is used by at least 72% of iPhone users (63% of all iOS devices). 30% use iOS 14, and only 7% iOS 13 and earlier versions. So it’s not a big deal, at least if your app doesn’t have to support all iOS users.

So, isn’t one of the biggest SwiftUI problems solved?

Well, yes and… no. The majority of iOS users run iOS 15 or iOS 14. This year, after the release of iOS 16, there will be almost no iOS 12 users anymore. This year practically all iOS devices will support Swift UI.

But support doesn’t mean that the situation is perfect.

SwiftUI is still a young framework. That's because it doesn't support various iOS versions in the same way, which is a strong con when it comes to building a B2B mobile application

As we know, SwiftUI is a relatively young framework. Its support is not the same in iOS 15 as in iOS 13 or iOS 14. It means that some functions, modifiers are not supported in all iOS versions that support SwiftUI. When coding, you’ll have to think if the method that you use is available only for iOS 15, or also for 14 and 13. It happens frequently, and it can be a pain in the neck.

You don’t believe it? Check the next paragraph. Things that on the one hand show that SwiftUI is growing old, can be on the other hand be perceived as disadvantages.

SwiftUI is growing old

Many things have changed since 2019 and SwiftUI is growing. Apple added ProgressView which can be used to show a task’s progress. We have access to embedding maps in views. A developer can create tappable links that will be opened in Safari. Many changes have appeared in VGrid and HGrid, and right now we can have three types of grid layout.

iOS 15 brought many changes in SwiftUI like Automatic image selection for TabView, primary actions for menus, and lots of other stuff that you can Google by yourself.

Apple also has added many modifiers in SwiftUI, like onChange(), scrollTo() or redacted(). Other changes are for example property wrappers like StateObject. Apple also deprecated some modifiers like animation() (from iOS 15).

As you can see, with iOS 15 came many new things. Many useful things. But you simply can’t use them on iOS 14 or iOS 13. You need to think about workarounds if your app is going to support older iOS versions. This means a lot of extra work to do. You need to support 3 different iOS versions.

And if you want to support macOS, there will be even more problems.

...but SwiftUI is still immature

Problems occur with some basic elements such as navigations.

For example, modal navigation can be quite difficult on iOS 13 because of the lack of APIs on this version. Not saying that the philosophy of interfaces is completely different than on UIKit. SwiftUI also doesn’t permit you to analyze the hierarchy of importance in XCode Previews.

Another example. In iOS 13 there is no support for WKWebView, so if you want to implement some web views, you’ll have to use UIViewRepresentable for the chosen components. Of course, this stuff is available directly in UIKit.

A serious problem of SwiftUI lies within bugs. Unfortunately, SwiftUI is still buggy, especially when working with navigation and lists. And if you want to use the aforementioned Previews, you’ll face many problems with rendering. Sometimes it’s easier to build an app based on the old approach than to wait for live rendering to start implementing the added changes. This can be really frustrating.

You should also remember to have good contact with UX designers. Some solutions that just work on UIKit won’t be easy to implement on SwiftUI. For example swipe actions on lists. On UIKit implementing them is easy peasy, but on SwiftUI (especially in iOS 13) it’s very hard. Or pull to refresh.

Wrapping up: Why you should not build a B2B app with SwiftUI in 2022

SwiftUI has proven itself to be a game-changer in the world of mobile systems. It’s easier and structured, and Apple is making many efforts to replace UIKit with SwiftUI. But there is still a lot to do and if you want to build a bigger or more complex app you’ll face issues during your work. This is because SwiftUI is still exceptionally youthful. You won’t find a lot of information on Stack Overflow.

In my opinion, it’s still not a good time to develop your business app with SwiftUI. But the situation isn’t similar to Swift and Objective-C. When Swift was introduced, it was just a change of syntax plus some new stuff in the first place. It means it was easier to leave Objective-C and start writing in Swift.

In the case of SwiftUI, we have more issues, mostly because the framework is something new and different than UIKit.

Therefore I think it will take time until using SwiftUI will be safe.

Till next time, folks!

Start a project with your dedicated software house

Top

Notice

We do not track you online. We use only session cookies and anonymous identifiers for the purposes specified in the cookie policy. No third-party trackers.

I understand
Elo Mordo!Elo Mordo!