Firebase + Swift logo header
Firebase + Swift logo header

Don’t let a human do a computer’s job

Swift’s Codable API, introduced in Swift 4, enables us to leverage the power of the compiler to make it easier to map data from serialised formats to Swift types.

You might have been using Codable to map data from a web API to your app’s data model (and vice versa), but it is much more flexible than that.

In this article, we’re going to look at how Codable can be used to map data from Firestore to Swift types and vice versa.

If you’re new to Cloud Firestore — it is a horizontally scaling NoSQL document database in the cloud

Swift Evolution

Concurrency just got a whole lot easier

programming symbol
programming symbol
Image by author

A lot of the code we write has to deal with asynchronous behaviour. Fetching data from the disk, sending a request to a remote API, or downloading an image — all these operations take time, even on your super-fast, low-latency working-from-home network.

A simple way of dealing with this is to just wait until a call has finished and the data we requested has arrived. The problem with this approach is that your app’s UI will freeze while it’s waiting. We’ve all used apps that seem to completely freeze up for certain tasks — it’s a terrible user experience.


👋🏻 Hello everyone!

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. …

Firebase Authentication

Replicating the iOS Reminders App, Part 4

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…

👋🏻 Hello everyone!

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!


Peter Friese
Developer Advocate, Firebase

👥 From the community

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! —…

Goodbye AppDelegate

An illustration of a rocket circling around the Earth.
An illustration of a rocket circling around the Earth.
Image based on Rocket by Icongeek26 on The Noun Project

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.

Specifying the Application Entry Point

One of the first questions we need to answer is “How can we tell the compiler about the entry point to our application?”

SwiftUI 2

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 AppDelegate or SceneDelegate classes any more. …

Application Architecture for SwiftUI & Firebase

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):

Get those important strings out of your code and into PLIST files

Image is based on Security by Komkrit Noenpoempisut from the Noun Project

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…

Application Architecture for SwiftUI & Firebase

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…

Peter Friese

Google Developer Advocate with the Firebase team 🔥

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store