Learning SwiftUI, MVVM and Firebase

Mike Haslam
5 min readMay 9, 2021

Getting past just following a tutorial

SwiftUI, MVVM and Firebase

SwiftUI is such a pleasure for a new iOS developer like myself. When you combine it with Firebase, it’s so much easier now to build robust apps. I want to share my journey in building a simple social media app.

I created a repository on GitHub that hopefully will be useful for others. I am always open for feedback, and other contributors would be super cool.

GitHub repository

In the app I’m working on, a user needs to create a story with an image. Also, it needs to be editable and the user should be able to delete their story. For the structure of the app, I choose to use the MVVM pattern.

So I went searching for some tutorials to get me started. I found a very helpful tutorial from the gang at Ray Wenderlich.

https://www.raywenderlich.com/11609977-getting-started-with-cloud-firestore-and-swiftui

The problem was once again tutorials only take you so far. The first challenge I encountered in following the RW tutorial was getting the Firebase SDK set up and initialized.

The reason being is my app uses the SwiftUI App Lifecycle so there is no scene or app delegate files. After a quick search, I found this solution…

--

--