Martin Vidovic2 min

Swiftly Highlights: Async/Await, the Future of Swift & Custom Codes

EngineeringFeb 2, 2022



Feb 2, 2022

Martin VidoviciOS Engineer

Share this article

With the new year come new opportunities and challenges. Whether it’s learning new things or expanding our knowledge, there are always topics that we as engineers find interesting and which are worth our attention. Check out which Five Things iOS Developers Should Focus On in 2022.

Swift Outside of the Apple Ecosystem

The Swift language is spreading outside of the Apple ecosystem. Swift 5.5 and the newly structured concurrency changes came with new opportunities to improve the server side Swift. But there is always room for improvement in Swift.

In The Future of Server Side Swift, you can read about possible future improvements, such as adding support with custom executor for Actors or introducing distributed actors to Swift.

Do you want to use Swift everywhere? There is a new library called SwiftHtml for rendering HTML docs. With the combination of server side framework Vapor, you can create documents with type-checking — so no worries about syntax errors in HTML. There is an excellent tutorial for you to start with: How to Write HTML in Swift.


Swift’s new build-in concurrency, introduced in version 5.5, provides a lightweight yet highly efficient set of tools for writing concurrent code. Although it is backward compatible all the way back to iOS 13 (and other Apple OS released in 2019), we still need to do some work to make those new features compatible with our own existing codebase. Good news is that it is fully compatible with Combine framework, introduced in 2019.

In this article, John Sundell shows us that with just a few convenient APIs in place, we can make it trivial to pass data and events between those two technologies — which, in turn, will let us keep using our Combine-based code even as we start adopting Async/Await and the rest of Swift’s concurrency system.

With the previously mentioned Async/Await, we can also use Task, which allows us to create a concurrent environment from a non-concurrent method. One interesting article we found mentions Async Execution of Long-running Operations. If you haven’t started with Tasks yet, here is an article describing How Tasks Work, With Code Examples, by Antoine van Der Lee.

Subscription Custom Codes

Apple now supports Custom Codes in Subscription. In addition to codes that can be used only once, there are now codes that can be redeemed by multiple users. These custom codes are ideal for large campaigns that require mass distribution.

Custom codes are redeemable through a direct URL or within your app on iOS 14.1 or iPadOS 14 or later. You can just set a maximum redemption limit and choose whether or not to set an expiration date.

With this change, Apple offers more options on how to offer users premium features and thus retain more subscribers.


News from SwiftUI brought us a great article that helps us to better define all sorts of depth-stacked view hierarchies with Backgrounds and Overlays. Check it out to see how SwiftUI’s layout system — mainly ZStack — can benefit from those two tools.

What’s More

Since the pandemic continues to keep as masked up, Apple has updated its Vision framework with new features, like improved face capturing quality and detecting a mask on a user’s face. The RayWenderlich team has created a new tutorial with an updated API; check out What’s New with Face Detection.

As always, thank you for reading! See you next time.

Share this article

Sign up to our newsletter

Monthly updates, real stuff, our views. No BS.