Firebase
Implementing Token Revocation for Sign in with Apple with Firebase Authentication
If your app allows users to create an account, you should also given them an easy way to close their account and delete all associated data.
Deleting user accounts in Firebase is pretty straight-forward - all you need to do is to call user.delete()
.
However, while this will delete the user's account, it will not delete any data the user might have stored in your app (e.g. in Cloud Firestore, Cloud Storage, or the Realtime Database).
Another thing you need to consider when deleting user accounts is revoking their access / refresh tokens if they used Sign in with Apple to create their account.
The good news is that Firebase makes deleting user data and revoking their tokens easy:
- Instead of writing code that iterates over all of the user's data on the client, you can use the Delete User Data Extension, which has a bunch of configuration options that allow you to adjust it to your data model - see the [documentation].(https://firebase.google.com/docs/extensions/official/delete-user-data)
- We've also implemented a
revokeToken
method on theUser
type, to make it easy to revoke the user's Sign in with Apple access / refresh tokens and comply with Apple's account deletion requirements.
In this video, I show you how to implement this in a SwiftUI app. I made sure to not just show the code, but also walk through the process of configuring your app in the Firebase console and Apple's developer portal. Enjoy!
#AskFirebase Live Twitter Space
On November 21st, we hosted a special edition of #AskFirebase Live on Twitter Spaces. I had the honour of being the host, and was joined by a bunch of SWEs, PMs, and DREs from around the Firebase team.
We got plenty of questions about the features we announced at Firebase Demo Day, and of course about other topics as well.
So, if you ever wanted to know if there is any advanced tooling coming up for Firebase Analytics and Crashlytics, how to get access to Duet AI in Firebase, how to manage your Firebase projects with Terraform, or how to use the new AI features in Firebase, check out the recording for answers to these and many other questions.
Also, please let me know if you'd like us to do more of these, and which topics you're most interested in - just reply to this email.
Computer History
Apple Museum in Warsaw
If you're planning a trip to Poland (for example for attending plSwift - see above), this looks like an amazing place to see.
According to their official website, they have over 1600 exhibits (including a replica of the Apple 1).
SwiftUI
Using the Observation framework outside of SwiftUI
In this post, Natalia discusses withObservationTracking(_:onChange:), and shows how to use it outside of the context of SwiftUI.
withObservationTracking
plays a key role in the Observation framework, and it's great to read some behind-the-scenes stuff about how it works.
Develop in Swift - New SwiftUI tutorials
Jake mentioned that Apple has launched a new set of tutorials (built using DocC, of course) covering development with SwiftUI. They're great for people who are just getting started with Swift and SwiftUI. If you've already got some experience with SwiftUI, and are looking to dive deeper, I would recommend one of the following tutorials:
Prevent code from running in a SwiftUI preview
Michael Tigas with a tip that sounds a little bit counterintuitive - why would you want to prevent your code from running?
This actually comes in handy when running your previews results in making network calls or hitting any other APIs that might have a noticeable latency or are metered in any way.
AI and ML
Inside the Coup at OpenAI
Unless you've been living under a rock, you've heard about the drama that played out at OpenAI. Many have tried to make sense of what has happened, including Kevin Roose and Casey Newton, hosts of one of my favourite podcasts, Hard Fork. They had no less than three episodes over the past couple of days:
- Emergency Pod: Sam Altman is Out at Open AI
- Mayhem at OpenAI + Our Interview With Sam Altman
- Sam Altman Rehired at OpenAI
However, I found this recent episode of The Daily with Michael Barbaro and Cade Metz to be much more useful in understanding the lead-up to the events of last week.
Give it a listen: Inside the Coup at OpenAI
Productivity
Xcode Tips
This is an excellent collection of tips and tricks for Xcode, put together by Toomas Vahter. Here are a few of my favourites:
- Double-click a curly brace to select the block it surrounds (#39)
- Open Xcode's command palette using
Shift
+Command
+A
(#36) - Simulate device conditions such as slow network or overheating device (#34)
- Resetting SwiftUI previews when they hang (#29)
- Use MARK, TODO, and FIXME keywords for structuring the jump bar (#14)
- Show build time in Xcode toolbar (#3)
Tools
Introduction to Kaleidoscope
Kaleidoscope is one of my favourite tools, alongside Tower. In this video, Sean walks you through how to use both together to compare files, perform code reviews, resolve merge conflicts (using Kaleidoscope's 3-way merge), and review pull requests.
He also shows how to use Kaleidoscope to improve your debugging flow in Xcode - this is a really useful feature, definitely check it out.
Conferences
Upcoming Swift / iOS conferences
It's that time of the year - many conferences have opened their CfP forms, so now is a good time to think about any talks that you might want to submit.
Here are some Swift / iOS conferences with open CfPs:
How to write great talk proposals
Speaking of which, here are some great tips for writing great talk proposals by none other than Maxim Cramer. If you've ever had the chance to see one of her talks, you know that these are solid tips.
It all starts with thinking about your audience...
Comment
As I am writing this newsletter, I am sitting in a hospital-turned-high-tech-office in Berlin, preparing the slides for my talk at DevFest Berlin tomorrow. If you see me, come and say hi! And if you don't manage to chat with me at the conference, drop me a line - I will be in Berlin for the next couple of weeks, and I'd love to meet up over a beverage of your choice.
The past couple of weeks have been extremely busy, and I am looking forward to all the exciting things that we will be shipping over the course of the next couple of weeks.
One project that was more work than I originally anticipated was making sure Firebase developers can revoke their users' access and refresh tokens for Sign in with Apple. Ultimately, it is just a single method call, but a lot had to happen behind the scenes to make this possible: from understanding the requirements, writing design documents, working with several engineering teams, updating the documentation, the sample apps, and publishing a video. I hope you will find the new API as easy to use as one of the people who commented on the video, saying "it is simple and clear".
Explaining things in simple and easy terms is one of my goals when creating content - be it videos, blog posts, or conference talks. This is why I was really happy to see Maxim outline her thought process for writing great talk proposals. I will definitely use her advice when submitting my next talk proposals - there are plenty of conferences coming up!
Speaking of which - if you have an idea for a talk, why don't you submit it to a conference? I've included a couple of CfPs in this episode. Even if you're a new speaker, I encourage you to take the step and give it a try - you might end up loving it as much as I do! And if speaking at a conference sounds a bit too scary - you can start by giving a talk at a local meet-up.
As always, I love to hear from you - if you've got any feedback, just hit reply.
Peter