View profile

📭Managing Empty State: Not Only Swift Weekly - Issue #11

Peter Friese
Peter Friese
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 Spacers. Side note: I sure hope he refactored the code a bit to make it more reusable 😅
Meng To
Fun way to use spacers in SwiftUI to create a custom tab bar https://t.co/g3mqjZb9Bs
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:
Donny Wals 👾
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. https://t.co/LqfZgMzxEC
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:
What's new in Firebase 2021 | Keynote
What's new in Firebase 2021 | Keynote
And here is a collection of deep-dive videos for some of the new features:
Learn | Firebase Summit 2021
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…
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.