Swift
Merge, CombineLatest, and Zip: Comparing Operators of Combine for iOS
This is a great overview of how to deal with multiple streams of events using the Merge
, CombineLatest
, and Zip
operators in Combine.
If this article leaves you wanting for more, check out my book (did I mention there is a 20% discount this week...?)
Converting A Swift String To A Bool
Sometimes, we need to convert strings to booleans, and thankfully, the Swift Standard Library includes code that makes this straight-forward - at least for the simple case of converting "true" / "false" to the respective boolean.
But what about other representations of true and false, such as YES and NO? Let alone localised versions, such as "Ja" / "Nein" or "Wahr" / "Falsch"....
Keith Harrison shows how to deal with this, and also discusses the performance implications.
SwiftUI
Presenting Expandable Text Fields In SwiftUI
For the longest time, TextField
s in SwiftUI could only display a single line. If you wanted to display multiple lines, you had to use a TextEditor. Starting with iOS 16, you can now tell TextField
to expand either vertically or horizontally, turning it into a multi-line text editor, which is very convenient for input forms.
aheze/SwipeActions: Add customizable swipe actions to any view.
Starting with iOS 15, SwiftUI supports swipe actions for List
rows. If you would like to support swipe actions for any other kind of view (or need more customisability), check out SwipeActions by Andrew Zheng.
ViewStateController: Debug State
Many views in modern applications progress through different states throughout their lifecycle: they might show an empty state, be in s loading state, show some error condition, or display some data downloaded from a remote system.
Manuel Herrera continues his work on his ViewStateController
framework which makes handling those states easier. In this blog post, he describes a debug utility that allows you to quickly put parts of your UI into different states for debugging / testing.
Business
Using phased releases to ship new features
Shipping new features to an existing user base can be risky, particularly on the App Store, where it is next to impossible to roll back if you notice your code contains fatal errors.
Stuart Wheelwright describes how he used phased releases to roll out his app to a limited number of users first before gradually ramping up.
If you'd like to have even more granular control, check out Firebase Remote Config, which allows you to roll out individual features of your app to different audiences based on a wide range of conditions.
Tools
What is purgeable disk space?
Free disk space is precious, especially for anyone who has to install several copies of Xcode, produces videos, or both.
Howard Oakley sheds some light on what is considered purgeable space - that ominous number Finder displays next to the amount of free space. His site contains a wealth of information about Macs and other Apple topics - definitely worth digging into if you're curious how the machine that you rely on daily works like.
Comment
Last week was super busy for me: I spent the week in London to record a bunch of videos for the Firebase channel on YouTube (take a look behind the scenes).
This is also the reason why this newsletter is late by a couple of days.
To make good for the delay, I'll include a discount code for my book, Asynchronous Programming with SwiftUI and Combine. Please use this link to order directly from the publisher (the code will only work there), and then enter the code "SwiftUI" during the checkout process. You should see a 20% discount before you advance to the payment step. If this doesn't work for any reason, please reply directly to this newsletter so I can help to work this out.
Peter ❤️🔥