View profile

🤔 Confirmation Dialogs in SwiftUI - Not Only Swift Weekly - Issue #13

Peter Friese
Peter Friese
👋🏻 Hello everyone!
Thanks to everyone who replied to my newsletter last week - it’s lovely to hear from you, and I appreciate the feedback. As my dear colleague @puf always says, “feedback is a gift”, so keep it coming!
Last week, I mentioned that I was planning to work on something really cool for Firebase Hackweek together with @mbleigh, and I am pleased to say we were able to achieve our goals for the week. If things go well, this will be the beginning of something a lot of you have been asking us for many times. It’s still early days, though, so stay tuned for updates - you’ll hear it here first.
This week, I spent some time on Make It So, the task list app that is a replica of Apple’s Reminder app. Read more about it in the blog post of the week.
As always, don’t forget to let me know if you liked the newsletter (there’s a little yes/no link at the end), and if you did, share it with a friend. If you didn’t like it, why don’t you write me a quick note what you’d like to see improved, and I’ll try to do better next week!
Thanks for reading,
Peter 🔥

This week's blog post
On my quest to replicate Apple’s Reminders app using just pure SwiftUI and Firebase, I spent some time this week to implement a confirmation dialog for Make It So. The idea is to prevent the user from accidentally losing any changes when they leave the edit dialog for a reminder. What seemed like something you might be able to implement in an hour or so ended up being a lot more complex than I would’ve thought in the beginning. Along the way, I discovered a couple of interesting things:
  • actionSheet is deprecated in iOS 15, and has been superseded by confirmationDialog 
  • You can now prevent the user from dismissing a sheet by using the new interactiveDismissDisabled view modifier.
  • Unfortunately, this view modifier lacks one crucial feature.
In the article, I go into more detail how to build a reusable solution for adding confirmation dialogs to your edit dialogs. I also implement a better version of interactiveDismissDisabled, but then I go on to tell you not to use it. Why? Read the article to find out!
What started as a discussion with a couple of other SwiftUI developers on the thread about replicating Apple’s Reminders app has already turned into a reusable utility for implementing focus handling on SwiftUI List views.
@peterfriese @erithacus_ @pointfreeco @focusstate Took another look at this recently, and decided to create a generic package, wrapping all the (at)FocusState code, eliminating the need to create an enum, and use a new property wrapper to focus on your data, not the id.
Example use:
Great stuff, I love how working in the open inspires people to make contributions to the community!
SwiftUI Environment When Presenting Views
Transferring your passwords and other credentials from one password manager to another one is a delicate and intricate process that might cause many of us quite a bit of anxiety. Most people I know stick with their password manager as long as possible. I have several hundred credentials in my password manager, and the idea of migrating them to a different password manager isn’t something I’d take lightly. At 1Password’s recent announcement to use Electron for their upcoming version 8 a lot of Mac users got pretty upset. If you’re on the market for a native password manager, check out this article by @simonbs - it walks through the process of migrating all passwords from 1Password to iCloud Keychain. Simon also discusses how to handle software licenses and backup codes. Definitely worth reading if you want to get an idea how much work is involved to migrate.
Moving from 1Password to iCloud Keychain
I already covered benchmarks comparing Intel-based Macs to M1-based Macs in issue #12, but the thermal photography in this tweet was too good to not add to this newsletter. It looks like Intel-based MacBooks have an afterburner!
Intel i7 MacBook Pro next to a M1 Pro Max MacBook Pro.

Both have been under the same light workload for the last hour.
Decoder is one of my favourite podcasts about the tech industry. In this episode, @reckless talks with the CEO of AirBnB about the future of work. Yep, that’s right - according to Brian Chesky, during the pandemic AirBnB has seen more and more people rent AirBnBs to work remotely. After all, if you can work remotely, you can work from anywhere.
Decoder with Nilay Patel: Why the future of work is the future of travel, with Airbnb CEO Brian Chesky (1h13m)
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.