šManaging Empty State: Not Only Swift Weekly - Issue #11
Hello everyone!
This week was super busy - I was a guest on Leo G Dionās Empower Apps podcast, Firebase Summit took place, I finished editing a screencast about Getting Started with Firebase Auth on the web, andĀ even found some time to continue working on Make It So (Appleās Reminder app, replicated using just SwiftUI and Firebase).
Next week I will participate in Firebase Hackweek, an internal event in which people from different teams across Firebase get together to work on stuff they donāt normally find time for. Curious what Iāll be working on? Check out this podcast, in which I briefly talk about my hackweek project.
As busy I might be, I always love hearing from you! Ping me on Twitter (either in public or via DM), send me an email, or buy me a coffee. And if you like this newsletter, forward it to a friend!
Thanks for reading,
Peter š„
Managing Empty State
This week, I was super busy with some behind-the-scenes work for Firebase Summit, among other things helping to launch the Firebase Extensions sample app and fielding questions for the Ask Firebase Live session:
In between, I did find some time to work on Make It So! My original plan was to finish the design and rough implementation of the reminder details screen. However, I got sidetracked by something which I thought was going to be just a small task (or a warm-up exercise, if you will): implementing empty state for the list of reminders.
You might not be aware of it (because most of us donāt ever have empty to-do listsā¦), but Appleās Reminders app displays a friendly empty state screen for empty lists:
So - āletās implement this real quickā I thought, and went on to wrap the List view in a conditional statement. Easy enough, hereās how that looks like for a simple Text
view:
But then I thought I could do better and decided to turn this into a full-blown view modifier. Not only will this allow me to reuse this in other screens (and projects), but this also made the final code easier to read and more expressive.Ā
Here is how you can use the new view modifier to display empty state instead of the view it is used on:
To learn more about this, and see the code for the EmptyStateViewModifier
Ā view modifier, head over to my blog and read Using View Modifiers to Display Empty State.
SwiftUI
I think SwiftUI has a very democratising effect - it is a lot easier to get started building simple UIs, and it seems to me that a lot of people who might have otherwise not considered it are now trying their hand at coding.Ā
Building visually appealing UIs has also gotten a lot easier. Check out this short clip in which @mengto prototypes a custom tab bar using Spacer
s. Side note: I sure hope he refactored the code a bit to make it more reusable š
Fun way to use spacers in SwiftUI to create a custom tab bar pic.twitter.com/g3mqjZb9Bs
ā Meng To (@MengTo) November 12, 2021
If youāve spent more than 5 minutes with List
views, you know how important it is to make your list items Identifiable
. And if youāre anything like me, you probably used the idās type when referring to it in any code that needs some type information. But did you know you can use YourType.ID
instead? Hereās @donnywals with a quick tip that you should definitely bookmark:
Swift pro-tip for passing around ids for your identifiable objects. Use https://t.co/k5ACbXzuyQ instead of the actual type when possible to make refactoring easier, and to make your intent clearer. pic.twitter.com/LqfZgMzxEC
ā Donny Wals š¾ (@DonnyWals) November 11, 2021
Firebase š„
Firebase Summit took place on November 10th, and we announce a couple of exciting new features. Personally, I am most excited about the enhanced support weāre bringing to Appleās platforms. I got to work on the demo app we showcased in the keynote together with @charlotteCLiang and @ryanwils - itās completely built in SwiftUI and runs on iOS, iPadOS, watchOS, macOS, and tvOS! Most of the code driving the business logic is driven by Firebase Extensions.
Hereās the keynote that walks you through all the new features:
|
And here is a collection of deep-dive videos for some of the new features:
|
|
Tools
Iām always interested in trying out new tools, and just this week I saw @subdigital mention he launched an update for Side Mirror - an app that makes it easier to deliver on-stage presentations that include some live-coding without having to look over your shoulder. If youāve ever had to give a conference talk on a stage that didnāt have a stage monitor in front of you, you will be painfully aware how awkward it is to look over your shoulder to see what youāre typing. Side Mirror promises to fix this issue by mirroring your presenter display to your main screen. Sounds complicated? Itās actually a lot easier than it sounds - check out Benās video on the product site! Iāll definitely give this one a try at the next conference Iām speaking at - provided it happens IRL!
And finallyā¦
Lol I love this pic.twitter.com/jsmxqkN0eC
ā Misael Landeros (@MisaelLandero) October 22, 2021