View profile

🔥 Firebase and Combine! Not Only Swift Weekly - Issue #15

Peter Friese
Peter Friese
👋🏻 Hi everyone!
The year is slowly drawing to an end, but - at least judging by the number of amazing articles and tweets people have published in the past week, it certainly doesn’t seem like anyone is going to take a break any time soon.
This week, I’ve curated a number of articles about SwiftUI and Combine (did you know Firebase also supports Combine?). There is also quite a bit of async/await, and I also found a number of nice tools that I did want to share with you.
As always, I love to hear your feedback for this newsletter! Just reply to this email, and it will arrive straight in my inbox. Even if you just want to say “Hi!” or send me a picture of where you live - don’t be shy!
Thanks for reading,
Peter 🔥
BTW, if you like this newsletter, tell a friend! Or, you know, buy me a coffee ☕.

What I am working on
As I continued working on MakeItSo this week, I realised that the app’s navigation bar title looks slightly different than Apple’s Reminder app. Turns out they started using round versions of the San Francisco font a while back. 
I don’t know about you, but I’ve got the impression that SwiftUI seems to follow Alan Kay’s adage “Simple things should be simple, complex things should be possible” (source) - specifying which font to use is a prime example of this principle!
SwiftUI defines a number of defaults for font styles most apps will be using over and over again, and these are defined as constants on Font : largeTitle, title, headline, body, caption, and others are text styles you will find in almost any app.
In addition, you can easily string together your own font to meet your app’s needs. For example, here is how you can create a rounded variant of the system font for any text labels that are of the style body:
.font(.system(.body, design: .rounded))
By assigning this to the root view of your application, this font style will now be used in every view of your app’s view hierarchy.
Unfortunately, this doesn’t apply to the text labels in the navigation bar. To achieve this, we have to use fall back to UIKit and use the UIAppearance API:
Using UIAppearance to set the font and color of the navigation title
Using UIAppearance to set the font and color of the navigation title
Now, while this certainly is one of those cases where we can implement a UI feature that is not (yet) supported by SwiftUI, it certainly feels like an easy-enough addition to the existing APIs that Apple should try and ship in the next point release of SwiftUI. Judging by the number of articles out there explaining how to implement this and the number of questions on StackOverflow, this is an issue many developers are running into. Maybe a good project for one of the interns that the SwiftUI team will be hosting?
I really enjoyed this conversation between John Sundell and Tim Condon about server-side Swift and Swift’s new concurrency model. It’s a really good overview of how async/await and Swift’s structured concurrency make development of server-side apps a lot easier. Of course, Tim and John also talk about the recently announced distributed actors, a feature that sets Swift apart from pretty much any other mainstream programming language, as Tim points out. Lots of other cool gems, Swift System (low-level system calls and types for Swift), libraries for handling multi-part encoded data, and JWT signing / verification. Definitely worth listening to!
Swift by Sundell: 110: “Concurrency beyond app development”, with special guest Tim Condon (1h1m)
Call it perception bias, but it seems to me this week was full of Combine content. First, Antoine took us on a deep dive about when to use use RunLoop.main vs. DispatchQueue.main (definitely worth reading if you care about smooth scrolling). Next, Natascha explained what back-pressure means in Combine and showed us some real-world examples. And finally, Rony gave a useful extension for Publisher that allows us to sink events without creating retain cycles.
SF Symbols have quickly become my favourite way to create icons for buttons and other UI elements. It’s so easy to include them in your app - no need to add them to your asset catalog, or create them in all the different sizes: just pick what you need from the SF Symbols app, and off you go! But did you know SF Symbols are configurable? Using the symbolVariant, we can easily compose an icon to our exact needs - including fill, color, outline shape, strike through, and a bunch of other visual aspects. Check our Sarun’s article to learn more.
On that note, you might want to check out Adaptive by Geoff Hackworth - it’s an interactive way to browse and configure SF Symbols.
Structural identity is an important aspect of SwiftUI views, and it can have a massive impact on your view’s performance and whether or not it animates well. Majid gives us a refresher.
And finally, Amos has a really neat and subtle use case for 3D rotations. Once again shows how powerful SwiftUI is.
🔥 Firebase
The latest version of the Firebase Apple SDK now contains support for Combine publishers. Check out the code snippets and the example app to learn more. So far, we’ve got support for Firebase Auth, Cloud Firestore, Cloud Functions, and Cloud Storage. Another PR with support for the Realtime Database is in the pipeline and should be ready to be merged soon.
Please check it out and leave us your feedback (on the discussions forums, the bug tracker, or on Twitter).
I mentioned it a few weeks ago, and now it has finally shipped - here is an intro video to using Firebase Authentication on the web using plain JavaScript:
Getting started with Firebase Authentication on the web - Firebase Fundamentals
Getting started with Firebase Authentication on the web - Firebase Fundamentals
Tools / Productivity
I mentioned Monodraw a couple of weeks ago - it’s a macOS app for creating ASCII art, but you can even use it to create software documentation with it. The author, Constantin Jacob, just announced he’s going to give away some licenses. I hear this is running for another couple of weeks, so check out the Ts&Cs here. Good luck!
Constantin Jacob
Due to a brief exchange with @ChristianSelig about ASCII art that sparked a good bit of interest I decided to run a giveaway of Monodraw.
If you'd like a license let me know what you'd use it for, no strings attached!

RTs appreciated!

More info:
Twitter might not be the best platform for running code reviews, but that doesn’t keep us from posting code snippets, right? While I’ve seen people mostly post screenshots of their code (using tools like, Carbon, or CodeShot, you can post code in a Tweet (like Paul Hudson asked people to do in this Tweet - check it out, it’s got some really cool answers!). For anyone that does, Ole Begemann has a nifty little tip how to prevent Twitter turning @State, @ObservedObject, and all those other property wrappers into clickable URLs:
Ole Begemann
Pro tip for people who write code in tweets:

#⁠if swift(>=5.5)
extension Foundation.⁠Data: @⁠unchecked Sendable {}

Use U+2060 WORD JOINER to prevent Twitter from converting things into mentions, hashtags, URLs.
Interested in working with me and a bunch of other great folks on Firebase? We’re hiring! Check out the following positions, and if you have any questions, don’t hesitate to reach out.
In case Android is more your thing - the Android DevRel team is hiring as well! I’ve worked on this team before joining Firebase, and can wholeheartedly recommend both the team and the work they do. Also, Chris (our just Cartland, as everyone calls him) is one of the nicest people you will ever meet.
Christopher Cartland
Come work with me! I'm hiring and our team has a lot of other roles available right now.
Apple is also hiring - here are two positions that readers of this newsletter might find interesting:
And finally...
I can confirm the portrayal of “ze Germans” in this clip is really hitting home 😂
Did you enjoy this issue? Yes No
Peter Friese
Peter Friese @peterfriese

Xcode tips & tricks, Swift, SwiftUI, Combine, Firebase, computing and internet history, and - of course - some fun stuff.

In order to unsubscribe, click here.
If you were forwarded this newsletter and you like it, you can subscribe here.
Created with Revue by Twitter.