Swift if and switch can now be expressions (www.avanderlee.com)
This is one feature that I missed from some other languages like Kotlin. It isn’t super useful for ifs but a switch with a lot of cases? Bring it on.
This is one feature that I missed from some other languages like Kotlin. It isn’t super useful for ifs but a switch with a lot of cases? Bring it on.
cross-posted from: programming.dev/post/3558087...
Type parameter packs and value parameter packs allow you to write a generic function that accepts an arbitrary number of arguments with distinct types. As a result of SE-393, SE-398, and SE-399, you can use this new feature from Swift 5.9.
#Predicate is a new Macro available since Swift 5.9 and Xcode 15, allowing you to filter or search a data collection. It can be seen as a replacement for the old-fashioned NSPredicate we’re used to from the Objective-C days.
MainActor is a new attribute introduced in Swift 5.5 as a global actor providing an executor which performs its tasks on the main thread. When building apps, it’s essential to perform UI updating tasks on the main thread, which can sometimes be challenging when using several background threads. Using the @MainActor attribute...
Best deeplink tutorial I’ve found for SwiftUI. My app interacts with Mastodon servers and I was struggling with action extensions for opening Mastodon links from Safari but it looks like using deeplinks and a Safari extension is a safer bet and much simpler to scale.