SwiftUI programming

Jun 13, 2019 · 2 mins read · Costantino Pistagna · @valv0

SwiftUI programming

SwiftUI certainly marks the beginning of a new era in Apple’s programming history. In the last years we have witnessed the proliferation of frameworks based on the concept of declarative interfaces and reactive programming; the web is a prime example of this phenomenon, but there are other notable examples in the field of mobile development. We are constantly amused with marketing messages that state how:

maintaining a single codebase for all platforms is the best way to increase business productivity and provide effective solutions to our customers.

React Native (Facebook) and Flutter (Google) are an excellent example of this proposition. It is not the purpose of this article to make a comparative analysis of these technologies; the point for which these two examples have been cited is to show how the software trend of recent years is moving in different directions from those we have been used to, up to now.

Our devices are increasingly powerful and this power finds its natural placement in increasingly sophisticated and complex interfaces and interaction paradigms. Last year, I wrote a piece about the release of iPhone X and the feeling of fluidity that this new device, combined with the latest stylistic choices of iOS 11 and 12, had aroused me.

Smooth, continuous and consistent animations, gestures merged within the navigation experience. These are just some examples of what I am trying to convey to you: the expectation bar has risen once again and these new features are not easily expressed with a traditional framework.

The discrete nature of imperative languages is in great difficulty, compared to the sense of continuity and fluidity imposed from new interface paradigms.

Apple has always been a very conservative company (Objective-C continues to operate and compile quite well) in relation to its development environments and, in general, with respect to its entire ecosystem.

The introduction of Swift, 5 years ago, with its new paradigms and its burst of modernity had already been a big sign of change by Cupertino. But it was clear that it was not enough. So, surprisingly for everyone, here comes Apple’s response to the other giants of the web: SwiftUI.

Fig.1

SwiftUI is a declarative component-oriented framework. Let’s forget, therefore, the MVC pattern where the controllers mediated between views and models. All we have in SwiftUI is a state and a view derived from the state. As soon as the status changes, SwiftUI reconstructs the interface taking these changes into account.

In a series of post, I’ll try to share my thoughts and personal travel notes, during the study of this new and, to some extent, mysterious framework.

I thought it could be useful, in the hope that it could be a starting point for learning something new and truly exciting.

-Happy Coding!

Costantino Pistagna
Costantino Pistagna · @valv0 Costantino is a software architect, project manager and consultant with more than ten years of experience in the software industry. He developed and managed projects for universities, medium-sized companies, multi-national corporations, and startups. He is among the first teachers for the Apple's iOS Developer Academy, based in Europe. Regularly, he lectures iOS development around the world, giving students the skills to develop their own high quality apps. While not writing apps, Costantino improves his chefs skills, travelling the world with his beautiful family.