As we’re on the final stretch of this year, we, the Firebase team, wanted to take a moment to reflect on the past year and express our gratitude to you, our readers and authors!
This year has turned out to be unlike any other, and I am sure many of us had to go through some difficult times. Despite all this, you’ve continued to amaze us with your resilience and creativity. At Firebase, we love to read about all the ways you use the tools and SDKs we provide. …
This article is part of a series of articles that explores building a real-world application using SwiftUI, Firebase, and a couple of other technologies.
Here are the previous parts of the series:
At the end of part 3, we briefly touched on an issue that users who sign in to the app on a secondary device might face:
You might think that using an app on two different devices should be an entirely reasonable thing to do. Still, when trying to sign-in on the second device, Firebase will return an error message saying
“This credential is already associated with a different user account”. …
We’re well into the final quarter of the year, and we wanted to send a quick roundup of some of our favourite articles we’ve published in the past three months.
We’ve had an amazing quarter here in Firebase Developers on Medium — thanks to all the great contributions many of you have sent us!
Developer Advocate, Firebase
When we started this publication, one of our main goals was to foster a community of people who are passionate about Firebase, and love to share their knowledge. We are extremely happy to see that — thanks to you! — this has worked out. We’ve got a diverse community of readers and authors who enjoy sharing their knowledge with other developers. …
For the longest time, iOS developers have used
AppDelegate as the main entry point for their applications. With the launch of SwiftUI2 at WWDC 2020, Apple has introduced a new application life cycle that (almost) completely does away with
AppDelegate, making way for a DSL-like approach.
In this article, I’ll discuss why this change was introduced and how you can make use of the new life cycle in new or existing apps.
One of the first questions we need to answer is “How can we tell the compiler about the entry point to our application?” …
For the longest time, iOS developers have used
UIApplicationDelegate to handle application startup and other lifecycle events in their apps. At WWDC 2020, Apple made some significant changes to how apps participate in the application lifecycle.
In this article, we’re going to take a look at what this means for your Firebase apps. For a more in-depth look at the new application lifecycle, check out this other article I wrote recently:
When you create a new SwiftUI app in Xcode, you will notice there are no
SceneDelegate classes any more. …
In this series of articles about SwiftUI and Firebase, we’re building a simple CRUD (Create, Read, Update, Delete) application that allows users to manage their book library.
In previous episodes,
The following screen flow diagram gives you an impression of what we’ve achieved so far (in the blue frame):
Many APIs require developers to provide an API key and/or API secret to be able to access the API.
This is both to identify the app that is accessing the API and to limit access to the API for apps that are known to the API.
Both the API key and the secret (if you have one) should be treated as a secret: Anyone who knows these can access and use the API, impersonating your app. This results in all sorts of security concerns: Depending on the type of API, an attacker might be able to access your application’s data, compromise your users’ data, and access information that is protected by the terms of service established between you and the service provider. …
Previously in this series of articles about SwiftUI and Firebase, we talked about fetching data from Cloud Firestore and how to map from Firestore documents to Swift structs using Swift’s Codable API.
You might recall that we also introduced a way to add new books to our collection of books in Firestore. To do so, we added a method
addBook(book:) to our view model. However, we didn't actually use it, as we didn't have a UI in place for entering the details about the new book.
So today, let’s look at how to build UI for adding a new book and how to update our view models to support this use case. …
Learn how to easily map Firestore data in Swift
Last time, we looked at how to connect a SwiftUI app to a Firebase project and synchronise data in real time. If you take a look at the code we used for mapping from Firestore documents to our Swift model structs, you will notice that is has a number of issues:
SwiftUI is an exciting new way to build UIs for iOS and Apple’s other platforms. By using a declarative syntax, it allows developers to separate concerns and focus on what’s relevant.
As with everything new, it sometimes takes a while to get used to how things are done in the new world. I often see people try to cram too many things into their SwiftUI views, resulting in less readable code that doesn’t work well.
It’s time to shake off the old habits of building MVCs (massive view controllers), folks!
In this blog post I’m going to show you a clean way to connect your SwiftUI app to Firebase and fetch data from Cloud Firestore. …