Building an iOS app using SwiftUI + Combine + MVVM [Part 3]
Learn step by step how to build an iOS application using the brand new Apple frameworks
This article guides you through building a complete app using only and exclusively those frameworks. Not only that, but we will also use a design pattern that has been gaining more and more traction in the Apple devs community. This is the MVVM architecture.
Before starting, note that this is the third and last part of the tutorial. For a better understanding of the exercise, please check out the previous parts:
- Building an iOS app using SwiftUI + Combine + MVVM [Part 1]
- Building an iOS app using SwiftUI + Combine + MVVM [Part 2]
If it’s the first time that you are going to work with this frameworks, then I’d recommend you start for the basics:
What we will build
In previous parts, we saw how to develop the application model apart from the generic ViewModel which is based in the Airbnb’s MvRx. We also build the first app view, the book list.
In this last part tutorial we will learn how to implement the remaining and more complex views of this app. This includes: book detail and checkout.
If we take a look at the code, we will see that several components are involved in the the implementation of those views. They are also important but we will focus in the main views.
Book detail view
This view contains further details about the book selected in the book list. Moreover, an action is presented to the users: They can add the book to the cart. They also can access to the shopping cart but this is related with the navigation flow.
Thus, this view has a state composed of the following elements: