Snapp Mobile iOS Newsletter

Issue 12 • October 18, 2024

Hi again,

This week we are taking a look into some practical Swift language features. We’ll have some UI/UX stuff next week, so until then - enjoy this week’s mixture.

Greets!

Swift

Inversion of Control in Swift: A Path to Cleaner Code

Most of us have faced the same problem when our applications become too big. Managing the codebase becomes slower and error-prone. Depending on the abstractions and our object coupling, this can become a bottleneck. Inversion of control is a technique we can use to overcome tight object coupling so that we can have modular, testable and manageable codebase.

Key Lessons When Moving Towards a Modular Codebase

Anyone who tried to modularize a large-scale codebase will tell you that the solution is often not only domain-specific, but quite challenging as well. There are good practices to stick to though. This article sums up some of them and it’s worth reading, even if your app is not there yet.

How to listen for property changes in an @Observable class using AsyncStreams

@Observable is much more than just a useful Swift Macro. It’s also a paradigm shift in how we manage data flows in SwiftUI that differs significantly in its implementation from the Combine-driven approach that SwiftUI was introduced with. One such difference hides in the way we can track data changes to a single property in an @Observable object.

Concurrency Step-by-Step: A Network Request

As Swift 6 is now out in the wild, more and more developers are introducing Concurrency-based features in their applications. This article is an extremely helpful resource that dives deep in what happens when you use a concurrent call to fetch something from the network. It explains the actor inference and why the use of the nonisolated keyword is safe and handy.

Swift Macros: Detailed & Practical Understanding

Swift Macros are the hype for some time now. Introduced with Swift 5.9 they are at the core of some impressive new capabilities that were previously not possible. It’s not an day-to-day experience to write them, but should you come to a point where a macro is needed - this article is your friend in uncovering what they are.

Swift Property Wrappers Explained

Before there were macros it’s the property wrappers that we used to introduce some behavior that goes along with a property. The way we see it, macros are not aiming at replacing the property wrappers so having some knowledge around them is another tool in your belt. Read on to discover more.

Instruments

The Memory Leak: An Xcode Detective Story

Debugging can be challenging for code we write ourselves, but it’s even harder when the problem is in a code that is inherited. For such cases having a proven debugging methodology is gold and this article dives deep into what it takes to examine the problem. Highly recommended.

Video

Beginners Guide: Embedded Swift and Visual Studio Code (with Code Completion

Embedded Swift was introduced at WWDC 2024 and even though there’s a repository of example projects, getting everything set up is quite an experience as Paul Solt discovers in this video.