Image for post
Image for post

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 different user account”. …


👋🏻 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!

Enjoy!

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! — this has worked out. We’ve got a diverse community of readers and authors who enjoy sharing their knowledge with other developers. …


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

Image for post
Image for post

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.

Image for post
Image for post

In previous episodes,

The following screen flow diagram gives you an impression of what we’ve achieved so far (in the blue frame):

Image for post
Image for post

You can use our sample app to add new books and display them in a list view. What’s missing is updating existing books or seeing their details. …


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

Image for post
Image for post
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, compromise your users’ data, and access information that is protected by the terms of service established between you and the service provider. …


Application Architecture for SwiftUI & Firebase

Image for post
Image for post

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


Application Architecture for SwiftUI & Firebase

Learn how to easily map Firestore data in Swift

Image for post
Image for post

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:

  • It is rather verbose — even for just the few attributes we’ve got!
  • The code makes some assumptions about the structure of the documents, such as the attribute types
  • Things might start breaking if we change the structure of the documents or the struct holding our…


Application Architecture for SwiftUI & Firebase

Image for post
Image for post

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


Image for post
Image for post

Rapid Application Development

Replicating the iOS Reminders App, Part 3

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 is an overview of the series and what we’re going to build:

  • In part 1 of the series, we focussed on building the UI with SwiftUI, using a simple data model.
  • In part 2, we connected the application to Firebase, and synchronized the user’s tasks with Cloud Firestore
  • In part 3 (which you are reading right now), we’re going to implement Sign in with Apple, allowing users to sign in from multiple devices to access their data, and laying the groundwork for advanced features such as sharing tasks with your family and…

About

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