Sign in

Google Developer Advocate with the Firebase team 🔥

Learn how to use async/await in SwiftUI apps

Logo reminiscent of SF Symbols logo
Image by the author (based on SF Symbols).

Without a doubt, one of the biggest announcements at WWDC21 was Swift Concurrency — most notably the support for async/await.

As developers, we’re constantly faced with the asynchronous nature of the apps we write. Reading a file from disk, fetching data from a remote API on the web, and even getting input from the user — all of these are asynchronous operations. Throughout the years, many different ways to deal with asynchronous code have been implemented. Most iOS developers will be familiar with Grand Central Dispatch, completion handlers, or delegates.

The new Swift Concurrency model builds on threads but abstracts…


Enhance your SwiftUI List Views

A splash of water
Photo by Amadej Tauses on Unsplash

Previously, we looked at how to use List views to create static list views. Static list views are useful for creating menus or settings screens in iOS apps, but List views become a lot more useful when we connect them to a data source.

Today, we’re going to look at a couple of examples of how you can use List views to display a dynamic list of data, such as a list of books. …


Everything you need to know about SwiftUI’s list views

Books stacked on shelves
Photo by Jason Leung on Unsplash

List views are probably one of the most important UI structures in iOS apps, and you’ll be hard-pressed to find an app that doesn’t use some sort of list.

SwiftUI makes it particularly easy to build list views; it just takes three lines to create a simple list! At the same time, SwiftUI’s List view is extremely powerful and versatile, so it pays off to get to know it in a little bit more detail.

In this series, I am going to teach you everything you need to know about List views, from simple lists, styling lists and their items…


Cancelling tasks just got a whole lot easier

red rectangle showing a white circle containing a red x
The header image is based on xmark.circle.fill from Apple's SF Symbols

Swift’s new concurrency features make it much easier to write correct concurrent code. This is achieved in a number of ways, most prominently by adding features like async/await to the Swift language itself, allowing the compiler to perform flow analysis and providing meaningful feedback to the developer.

As Doug points out in this post on the Swift forums, “Swift has always been designed to be safe-by-default,” and “an explicit goal of the concurrency effort for Swift 6 is to make safe-by-default also extend to data races.”

In this series of articles and videos, my goal is to walk you through…


SwiftUI now allows using item bindings in lists. See how it’s implemented behind the scenes

Three bullet points followed by lines
Image by the author.

Lists are probably one of the most popular UI elements in iOS apps, and we’ve come a long way since UITableViewController was first introduced. Creating lists in UIKit wasn't exactly rocket science, but it did require some ceremony.

SwiftUI has made creating lists really easy. Check out this snippet that displays a list of to-dos:

With just three lines of code, we’re able to create a simple list view.

Things get slightly more complicated once we try to make the items in the list rows editable. For example, TextField requires a binding to the element we want to edit:


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

So…


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

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

Peter Friese

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