Firebase
Firebase Demo Day on November 8th, 2023
The Firebase team will host a virtual experience (dubbed "Firebase Demo Day"), where we will demonstrate a bunch of cool new things that we've been working on.
Be sure to save the date: November 8th, 2023.
Oh, and we will also be running a special episode of #AskFirebase Live, the show in which we answer your burning questions. Stay tuned for more details about this later, but - as subscribers of this newsletters I can let you in on a secret: I will be hosting the show! So feel free to send me your burning questions for the guests of the show - just reply to this email!
Seeding Firestore Data in Emulator
In issue #34, I mentioned the Firebase Emulator Suite - this is an easy way to run (or rather emulate) Firebase locally on your development machine. Not only does this cut short the turn-around-times for deploying Cloud Functions to your project, it also allows you to test your app with the confident feeling that you won't accidentally mess up any production data.
In this article, Tomas walks you through the process of seeding data to Cloud Firestore in the Firebase Emulator, which is a super useful technique to make sure your tests always start from a reproducible state.
Swift
Observation in the World of Combine and Swift Async
If you think Combine is no longer useful, and you should instead move to Apple's new Observation API, this article might change your mind.
Deliver reusable components without making them reusable
Naming things is one of the hardest exercises(1), as all of us know. I mean, how many times have you stared into the distance, hoping inspiration would strike and you'd somehow magically come up with a great name for a variable, method name, or class name?
In this article, Tjerd demonstrates that naming things right can help us decide when to go for code re-use or not.
(1) also - native speakers - please have mercy with us non-native speakers. It's not a good sign if I have to use the dictionary to look up the meaning of a method name.
SwiftUI
Updating the navigation title per section
This is a nifty little tip by Swift Dev, and I bet most of us weren't aware that this works. The reason why this works in the first place is that SwiftUI makes heavy use of the environment - whenever you use a view modifier, this essentially modifies the environment for the view you apply it to.
The navigationTitle
is one of the few view modifiers that use SwiftUI's PreferenceKey
to propagate values up the view hierarchy instead of down.
To learn more about how PreferenceKey
works, check out Federico's article How SwiftUI's Preference Keys are propagated
Personally, I think the naming of "PreferenceKey" is a bit unfortunate - my first association would be "user preferences", but - I'll admit that naming things is hard.
My tutorial "Building Reusable SwiftUI Components" includes a module that explains how the SwiftUI environment works - check it out!
Tools
Run your SwiftUI app on Native Android (Jetpack Compose)
In the intro to Not only Swift #44, I briefly talked about a recent episode of Swift over Coffee, in which Mikaela and Paul talk about the question "should you use Swift everywhere, or is it better to learn other languages, too".
I encourage you to listen to their podcast, as they read the answers they've gotten from around the community and then provide their own thoughts.
It seems the idea of writing your code once, and then being able to deploy it "everywhere" sounds pretty promising to people, and there is no shortage of cross-platform tools that make this possible to a varying degree of quality.
The latest addition is Skip by Abe White - a transpiler that translates your Swift and SwiftUI code to Kotlin and Jetpack Compose. The intro video looks promising, and I can see how using a tool like this might be interesting to get you off the ground quickly if you need to create an app that works on both iOS and Android, and you neither have a an Android team, nor are you willing to use a tool like Flutter.
Here is a thread (including some source code) that shows how Amit built an app using Skip.
Definitely worth observing!
Design
How to create GIFs with beautiful code animations
If you are an iOS / Swift developer, I am sure you have seen Vincent's fantastic animated GIFs (no idea what I am talking about? Check out this page on his blog).
If you're curious how to achieve the same - Vincent spilled the beans in one of his recent newsletters. Here is the link to the article in which he describes his process.
This is a great way to demonstrate code on social media, and also in presentations (if you've been to any of my talks, you might know what I am talking about), and with some practice, it's easy to achieve amazing results!
Hackreels - creating animated GIFs of your code
Now, if you'd rather not spend a lot of time creating beautifully animated GIFs of your code using Keynote, Hackreels might be just the tool for you.
It supports bunch of languages and frameworks (albeit a bit web-focused), and is capable of creating transparent videos.
There is some room for improvement, though: you might notice that some characters are randomly flying around between the different stages of the animations, which is something that you can avoid in Keynote. But - it's a great start, and I expect they will fix those issues in subsequent releases.
Comment
As I mentioned last week, I will be at a couple of meet-ups and DevFests this week, and as a service to anyone who is busy working on their slide decks, I've included two links that might help you build more beautiful (code) slides with less effort. I have been using the same approach as Vincent for years (as you might know if you've seen any of my presentations), and couldn't be happier.
Speaking of which: in one of my talks ("How I used Siri, PaLM, LangChain, and Firebase to create an Exobrain"), I demonstrate how to create a personal knowledge management tool using SwiftUI, Firebase, PaLM, and CloudSQL / pgvector.
Obviously, I built the frontend of the app using Swift and SwiftUI. Now, one of the drawbacks of this approach is that Android developers are left out. So - what if I could build Android / Jetpack Compose apps using SwiftUI? In this issue, I discuss a tool that promises to do exactly that - write once, and run everywhere.
What are your experiences with cross-platform tools, and which approach would you recommend?
Peter