Understanding Dependency Cycles: How SparkDI Uses DFS for Detection

Imagine you’re building a house of cards. Each card depends on others for support, creating a delicate but stable structure. Now imagine two cards needed to support each other simultaneously — it would be physically impossible to build. This is exactly the problem we face with dependencies in software development. 🔁 A Real-World Example In this scenario: AuthenticationService needs UserService to verify user permissions UserService needs ProfileService to get user details ProfileService needs AuthenticationService to access secure data This creates an impossible situation: none of these services can be initialized because each depends on another that isn’t yet created. It’s like trying to solve the classic chicken-and-egg problem. ...

February 24, 2025 · 2 min · Walid Sassi

Dependency Injection in Swift with Michael Long

🎙️ Episode — A Conversation with Michael Long In this episode, I sit down with Michael Long, seasoned Swift developer and creator of Resolver and Factory, two powerful dependency injection (DI) containers for Apple platforms. We dive deep into dependency injection and how to build robust Swift applications. We discuss his journey with Resolver, the challenges of cycle detection, and his latest project aimed at improving navigation in SwiftUI. 💡 Key Topics Covered 1. Building Dependency Injection with Resolver The philosophy behind Resolver and how it differs from other DI frameworks. Why simplicity and flexibility are crucial for Swift developers. How to leverage Resolver’s Factory and Scopes to enhance modularity and performance. 2. Cycle Detection and Memory Management The challenges of detecting circular dependencies in complex projects. Techniques to mitigate memory leaks and improve application stability. How Resolver handles cycle detection and why it’s essential for long-lived objects. 3. A Fresh Take on Navigator in SwiftUI Michael’s new approach to navigation designed specifically for SwiftUI. How this project aims to overcome the limitations of the existing navigation stack. Practical tips on integrating this new solution into real-world apps. 📌 Why Listen to This Episode? By the end of this episode, you’ll gain valuable insights into building cleaner and more modular Swift applications using Resolver. You’ll also discover innovative ways to tackle common DI challenges and learn about a promising navigation solution for SwiftUI. ...

February 6, 2025 · 2 min · Walid Sassi