SwiftUI learning curve in 2019
This year we had a massive change in iOS development world. We got a SwiftUI framework. SwiftUI is a brand new declarative way of building apps for Apple ecosystem. Let’s build our learning curve. I want to share with you the list of all the needed posts to learn SwiftUI.
Apple did an excellent job this year by creating the SwiftUI tutorials page. I suggest starting with those tutorials to learn the basics of SwiftUI.
One of the new features of the Swift language powering SwiftUI framework is property wrappers. To learn about the most important property wrappers like @State, @Binding, @ObservedObject, @EnvironmentObject, and @Environment read my “Understanding Property Wrappers in SwiftUI” post.
Another post that I wrote about the mechanics of SwiftUI is “You have to change mindset to use SwiftUI”. It should help you to understand how SwiftUI works under the hood.
SwiftUI also has a brand new layout system, which I enjoy much more than AutoLayout. The new layout system is very powerful and straightforward. I highly suggest you read these posts to understand the new layout system and its benefits.
- SwiftUI Layout System
- Inspecting the View Tree – Part 1: PreferenceKey
- Inspecting the View Tree – Part 2: AnchorPreferences
- Inspecting the View Tree – Part 3: Nested Views
SwiftUI has a lot of similarities with React framework, which brings many new concepts to iOS development. I’ve built a few apps using those ideas and really like how it works. Here is the list of useful posts.
- Introducing Container views in SwiftUI
- Modeling app state using Store objects in SwiftUI
- Redux-like state container in SwiftUI
Declarative nature of SwiftUI
SwiftUI is a declarative framework. It means you declare what you want to achieve, and the framework takes care of that and decides how to render your views. The very same view can have another look, depending on the context. I wrote a few posts about the declarative approach in SwiftUI.
- Building forms with SwiftUI
- View composition in SwiftUI
- Reusing SwiftUI views across Apple platforms
- ViewModifiers in SwiftUI
- Composable styling in SwiftUI
Animations and interactions
SwiftUI handles all the state changes using animations just for free for you. It allows us to build interactive views in a very straightforward and nice way. I covered this topic many times on my blog.
- Animations in SwiftUI
- Gestures in SwiftUI
- Building Bottom sheet in SwiftUI
- Building Pager view in SwiftUI
I also want to mention the excellent series of posts by Javier about advanced animations in SwiftUI.
- Advanced SwiftUI Animations – Part 1: Paths
- Advanced SwiftUI Animations – Part 2: GeometryEffect
- Advanced SwiftUI Animations – Part 3: AnimatableModifier
SwiftUI did another step to make our apps accessible by default. It works very well out of the box, but it also provides a very nice API to customize the accessibility tree. To learn more about accessibility in SwiftUI, I suggest reading these articles:
Drawing custom views
SwiftUI provides a lovely Shape API that allows us to build custom views quickly. I learned it while making charts in one of my apps.
SwiftUI has unique features like Environment and Preferences, which we don’t have in UIKit. To learn more about these features, take a look at the next posts.
- The power of Environment in SwiftUI
- The magic of view preferences in SwiftUI
- The power of @ViewBuilder in SwiftUI
It was a huge year, and I hope we will get SwiftUI 2.0 with a lot of new features during WWDC 2020. We have many things to learn until the next release of SwiftUI. Let’s say thanks to our awesome community which wrote all these articles. Merry Christmas and Happy New Year!