What I am working on
Getting started with Account Linking Anonymous Auth on Apple platforms
A while ago, Roman Nurik and I talked about improving the onboarding flows for your app, and one of the things we talked about was wether or not you should ask your users to create an account before they can start using your app (spoiler: expect for very few use cases such as banking, you should probably not do that).
This week, I've finished work on a video in which I show you how to implement a smooth onboarding flow using Firebase Anonymous Authentication and Account Linking.
The video just went live. Let me know what you think!
Firebase
Firestore's @FirestoreQuery property wrapper for SwiftUI
Syncing data in real time is one of my all-time favourite features of RTDB and Firestore. But to properly implement this, you'll end up writing quite a couple of lines of code (see this and the following slides.
The @FirestoreQuery
property wrapper makes this a lot easier: subscribing to a Firestore collection takes just a single line of code. Filtering and querying is also super easy. Check out Brianna's article for a quick overview of the key features.
Computer History
This week, 50 years go: the first ever call from a cell phone
This week, 50 years ago, Marty Cooper, engineer at Motorola, made the first ever call from a cell phone.
It was a lot heavier than today's phones, clocking in at 1kg, and had just enough battery for 30 minutes...
Watch the entire clip to get a glimpse of some cell phone icons (no, not the ones on your home screen...).
What was your first phone? Mine was the Panasonic EB-G520 .
JSON vs XML with Douglas Crockford
It is safe to assume that every Swift programmer has used JSON before (Swift even has a protocol that was mostly added to the language to make parsing JSON easier, and save thousands of developer's hours having to implement JSON parsers)
This is a fascinating episode with Douglas Crockford, who you might know as the author of "JavaScript - The Good Parts", and the inventor of JSON. If, like Paul mentioned here, you find JSON hard to read, you should count yourself lucky that you don't have to deal with XML...
Anyway, go check out this episode, it is an amazing view into a time when the internet went from "poorly designed" to what we know today.
SwiftUI
NSFetchedResultsController wrapper for SwiftUI view models
I found this article about the CoreData @FetchRequest
property wrapper quite interesting - as you might know, Firebase has a similar property wrapper (@FirestoreQuery
) which lets you connect your SwiftUI view to a Firestore collection (or query) with a single line of code.
Just like @FetchRequest
, @FirestoreQuery
can only be used on a SwiftUI view, but I've heard from a couple of people who would like to be able to use this inside an ObservableObject
as well.
As improving the @FirestoreQuery
has been on my mind for quite some time, I am curious about your thoughts: would you like to use @FirestoreQuery
inside an ObservableObject
?
When Matched Geometry Effect Doesn't Work
I am sure you've experienced situations in which a piece of code didn't do what you thought it should do. Most of us would probably start searching StackOverflow, ask around on Twitter, or wrestle with the code in a trial-and-error fashion until we either find out what's wrong, or give up in frustration.
Not so Chris. When matchedGeometryEffect
didn't work the way he expected, he instead re-implemented matchGeometryEffect to understand how it works.
Obviously, the amount of time and effort that goes into re-implementing something that doesn't seem to work might not always pay off, but it's definitely an approach keeping in the back of your mind for when you next run into an issue.
Of course, all of this would be obsolete if the respective source code was open sourced...
Drag and drop transferable data in SwiftUI | Swift with Majid
It's actually quite amazing that you can add drag'n'drop to your SwiftUI app with just one or two, and it reminded of the fact that iOS supports cross-app drag'n'drop. I usually use copy & paste most of the time, but I might start using D'n'D more often now.
Productivity
Mirror your Apple Watch to your iPhone
This looks like a useful feature for anyone who would like to record the screen of their watch. To see this in action, check out this AppleInsider video - pretty impressive, you can even remotely control your watch by tapping on its representation on your phone screen.
Unfortunately, this requires at least an Apple Watch Series 6 or greater, Apple Watch SE 2, or Apple Watch Ultra. I guess it's time to upgrade my Series 5...
Fun stuff
Now available to pre-order: Swift Against Humanity
I'm actually disappointed this was just an April's fools. But I imagine if enough people plead with Paul, he might cave in and make it a thing.
Comment
I've just received news from Apple that I wasn't randomly selected to attend the WWDC23 kick-off at Apple Park, but it seems like many others were lucky enough! It's always great to get together and celebrate the launch of new APIs and products, and I am happy for everyone who gets the chance to go and experience this in person, hang out with other people from the community, and chat with some of the engineers and other people who build the platforms we all use and love.
Speaking of which, I am looking forward to seeing many of you at one of our Google I/O Connect events or at one of the many Swift and iOS conferences throughout the year. If you spot me, say hi!
Also, don't forget to cast your vote in the Swift Community Awards - final voting is still open!
Peter 🔥