SwiftUI Programming

Costantino Pistagna

SwiftUI certainly marks the beginning of a new chapter in the history of development at Apple. For years we have witnessed the proliferation of frameworks based on the concept of declarative interfaces; 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 by the new interfaces.

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.

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.

Those that follow are our personal travel notes, during the study of this new and, to some extent, mysterious framework. We thought it useful to share this information with all of you in the hope that it will be a starting point for learning something truly exciting.


--Have a good trip!

Next article: SwiftUI - The View object

© Copyright 2019 Sofapps - All Rights Reserved - VAT 05197020877