Breno Valadão2 min

Swiftly Highlights: New Betas, Tasks & SwiftUI

EngineeringMar 6, 2023

Engineering

/

Mar 6, 2023

Breno ValadãoSenior iOS Engineer

Share this article

Winter is almost over and a great way to enjoy its remaining days is by checking out the latest beta releases from Apple.

The new beta versions of iOS 16.4 and macOS 13.3 are already available. App Store Connect also got an update along with the new beta, so we’re now all set to get our apps ready for the new iOS versions.

As we’ve already mentioned in previous editions, 2023 might be the year when Apple releases its Apple Glasses gadget — and thanks to new rumors and leaks speculating about the release date and price, we’re getting even more hyped.

Swift: Tasks & Regex

Async Await has been a hot topic since day one and today, we’re sharing two great articles about Tasks by SwiftLee and The.Swift.Dev. The first explains detached tasks in Swift, showing how to create a new top-level task and disconnect it from the current structured concurrency context. The second is about running tasks in parallel, specifically making our code faster by utilizing multiple CPU cores. Both articles come with great, clear code examples.

Another interesting topic that’s not quite that hot — sometimes it’s even avoided — is Regex. We found an excellent tutorial on getting started with Swift Regex from Kodeco, where you’ll be able to see and learn how the new Swift Regex API works in practice.

SwiftUI: Styles & Modifiers

One of the most powerful features of SwiftUI is how it allows us to reuse UI components and their styles — and this past month, we learned a nice way to reuse and share styles in our custom views the same way. Just check out Styling Component in SwiftUI from Moving Parts for more information about it.

Speaking of SwiftUI styles, ever wondered how to create a custom toggle component just by building a toggle style? `ToggleStyle` is the way to go — no more building full custom components.

When building SwiftUI components, we may sometimes ask ourselves: “Should I create this as a view or a modifier?” In the end, we might get almost the same outcome — but we should think about the reusability and flexibility of our components beforehand; this could bring new weight to the decision. SwiftBySundell goes deep into details about View vs. Modifiers in SwiftUI.

One Last Thing

Reminder that “The Swift Programming Language” book has now been published with DocC.

That concludes this edition of Swiftly Highlights, almost as quickly as February seems to have passed by. Thank you for checking it out, and see you next time!

Share this article