Adopting SwiftUI
Tags: swift, swiftui, ios
Published: 2021-06-11 16:53:32

## Introduction
There has been a debate among the iOS developer community about adopting SwiftUI since Apple introduced this framework in 2019. Adopting a new technology is always risky, and comes with many challenges, but we still decided, at NewDay, to adopt this new technology very early in 2020.

This post explains the reasons why we made this decision, the challenges that we faced, and how we embraced SwiftUI in our iOS development process.

---

## What is SwiftUI?

![SwiftUI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/75l98oaatygbdnujd4yp.png)

> SwiftUI is an innovative, exceptionally simple way to build user interfaces across all Apple platforms with the power of Swift. Build user interfaces for any Apple device using just one set of tools and APIs. With a declarative Swift syntax that’s easy to read and natural to write, SwiftUI works seamlessly with new Xcode design tools to keep your code and design perfectly in sync.
>
> Apple Inc.

[SwiftUI](https://developer.apple.com/xcode/swiftui/) is Apple’s take on [Declarative UI Programming](https://en.wikipedia.org/wiki/Declarative_programming), and is a faster, cleaner and more interactive way to code UI on the iOS platform. It also comes with some caveats.

**Pros**:
* Declarative syntax
* Fast, clean and interactive
* Works well with Combine
* UIKit compatibility

**Cons**:
* Supported only on iOS 13+
* Limited list of UI components
* Lack of support from the developer community
* Tightly coupled views

---

### Btw, what is Combine? :thinking:

It would not be fair to talk about SwiftUI without mentioning [Combine](https://developer.apple.com/documentation/combine), which is Apple’s take on [Reactive Programming](https://en.wikipedia.org/wiki/Reactive_programming). Like SwiftUI, Combine is only available from iOS 13+.

Combine is, by essence, very similar to SwiftUI, and therefore still perfectible. It is a strong contender to replace, in the next few years, other native reactive programming frameworks such as [RxSwift](https://github.com/ReactiveX/RxSwift) or [ReactiveSwift](https://github.com/ReactiveCocoa/ReactiveSwift).

Combine can be used without SwiftUI, but SwiftUI is very dependent on Combine.

---

## Is SwiftUI Ready for Production?

That's the big question. We at NewDay believed very early in 2020 that we could push SwiftUI code to production, and in doing so, would benefit our development and delivery processes.

---

## Why did we adopt SwiftUI?

Our decision was based on several factors:
* [iOS 13 adoption rate](#iOS-13-adoption-rate)
* [Pushing new features](#aqua-coach)
* [Replacing web views by native code](#account-summary)
* [Launching new applications](#bip)
* [Adopting the latest technologies](#latest-tech)

---

### High iOS 13 adoption rate <a name="iOS-13-adoption-rate"></a>

The adoption rate of new versions of mobile operating systems has always been much faster on iOS than on Android, and iOS 13 was no exception. Apple released iOS 13.0 on September 2019, and by January 2020, 80% of iOS users (worldwide) already adopted it.

![iOS 13 Adoption Rate - source: MixPanel](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rz2s1bj3n4i64c75t49r.png)

We assumed that given time, this rate would go much higher. We originally thought about pushing our first SwiftUI code to production in September 2020, so very close to the iOS 14 launch date, but we postponed this to later in the year - December 2020. 

In February 2021, more than 92.5% of our iOS users use our apps on iOS 14, and with about 4% using iOS 13. These numbers seem to confirm that our original assumption, which was shared with our stakeholders, was correct, and the lack of support of older versions of iOS was not a blocker for fully embracing SwiftUI at NewDay.

---

### A New Feature - Aqua Coach <a name="aqua-coach"></a>

![Aqua Coach](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/28m79ba9o2dwh90fhp46.png)

We decided to use SwiftUI to implement new features, whenever possible. The very first feature benefitting from this was Aqua Coach, a credit score functionality that we added in the Aqua Card app in December 2020.

---

### A New Native Screen - Account Summary <a name="account-summary"></a>

Our mobile apps are currently partly hybrid. Some screens just use web views to display contents, which give users a poor user experience. 

We plan to keep these web views as long as our apps support iOS 12 (or under), and present brand new native screens, coded in SwiftUI, for our users using iOS 13+ devices.

The new Account Summary will be the first of such screens, and will be available soon.

---

### A New Application - bip <a name="bip"></a>

![Bip](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a728c1faih5xvslkazwb.png)

We have used SwiftUI and Combine to write our brand new **bip** iOS app. We originally planned to launch the app in September 2020, but decided to postpone to Q2 2021 instead. This decision gave our users, even more time, to adopt iOS 13 (and now iOS 14).

---

> [bip](https://www.bip.credit) is an innovative product, a mobile app only service, targeting a younger generation of users, who, potentially, own recent phones running on the latest version of the operating system.

---

Using SwiftUI to code all the screens helped us tremendously as there were numerous screens in bip mobile app in terms of application forms.

**[bip](https://www.bip.credit) is now available on the App Store and Google Play Store.**

<a href='https://apps.apple.com/us/app/bip/id1541023957'><img alt='Download on the App Store' src='https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jdk6za6l3ti58e3mklae.png'/></a>

<a href='https://play.google.com/store/apps/details?id=com.newdaycards.bip&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'><img alt='Get it on Google Play' src='https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0028yb79a7pf382lr5nq.png'/></a>

---

### Adopting The Latest Technologies <a name="latest-tech"></a>

NewDay is a tech-driven company. We want to adopt the best practices, the best technologies in order to deliver better, faster and create reliable apps. We also want to attract new talent who want to embrace these goals.

> SwiftUI is surely one of the best example of such tools on the iOS platform.

---

## The Future of SwiftUI at NewDay

We strongly believe that SwiftUI and Combine will play an important part in iOS development in the years to come. Even though we admit that these frameworks are still perfectible, there is no doubt that Apple will refine and improve them overtime.

Apple being Apple, it is also likely they will start to gradually deprecate UIKit pretty soon, and entice iOS developers to adopt SwiftUI instead.