One of the best announcement in 2019 was SwiftUI a complete different way to build visual interfaces more declarative and intuitive. Following Android with Jetpack Compose (both inspired by React Native ) Apple launched into the task of changing the old way that him have for make views.
A Little history
Formerly for make apps in Apple environment we have to familiarizing with Storyboard this is a little difficult if you are a front-end developer used to web programming, concepts like a constraints, xibs and the way to connect the components with the view was something tedious, archaic and unintuitive. Also StoryBoards were difficult to merge, they almost always gave merge conflicts if 2 developers were working on the same StoryBoard even if they had not touched the same view, and they were difficult to undock.
SwiftUI and iOS 13
SwiftUI work with iOS13+ and this is for a simple reason and it have to do binary stability of the OS. Before iOS13 each app loaded in the SO have the specific resources library for the specific version of the code. Now iOS13 bring the resource library preloaded and can be understood with any app from iOS13, fir this reason the apps building for iOS13+ will weight less.
How work SwiftUI
Those who have worked with React Native will found it very similar in the way to work, basically we have a view that return a body in where we have all the container at first level, just we can have one, and in that we can put anything you want, for example we can put a toolbar, like a first level, and nested containers inside.
What about the data?, we can pass data between different views that we use, use data enumerations within the structure itself, or create synchronous data sources that provide us with objects as dynamic data. Even asynchronous data that once retrieved causes events in the interface to be displayed. We can also give status to a property and each time it changes(DataBinding), the view on the screen will be redrawn. In the next example we have a NavigationView like a first container, so in the inside, we have a List with nested element like stacks and labels.
SwiftUI is a new tools than allow create views that a way more intuitive, simple and declarative. After having working with React Native i realized of the archaic that Storyboard was. For that i loveled it SwiftUI. What do you think?
Top comments (1)
Hi, thanks for your sharing, I am a beginner of SwiftUI, I totally practiced Apple official Landmarks, but I feel to need more experience . Do you have any suggestion course or book? Thanks again