Lightweight dependency injection and unit testing using async functions
Let’s explore how we could make use of Swift’s async/await capabilities to make our asynchronous code fully testable in a very lightweight way.
Articles, podcasts and news about Swift development, by John Sundell.
Let’s explore how we could make use of Swift’s async/await capabilities to make our asynchronous code fully testable in a very lightweight way.
One of the most important roles of any software architecture is to make the relationships between the various objects and values within an application as clear as possible. This week, let's take a look at how we can do that by using the type system to set up locks and keys to get a stronger, compile-time guarantee that the intended flow of our app will remain intact at runtime.
Brandon Williams and Stephen Celis, formerly iOS developers at Kickstarter and now hosts of Point-Free, join John to talk about functional programming in Swift, and how it can be used to build apps, websites, and even control the world.
Radek Pietruszewski, software writer at Nozbe and creator of SwiftyUserDefaults, joins John to talk about developer seniority, being inspired by the React paradigm, singletons & dependency injection, micro features and much more.
Just like with most programming techniques, there are multiple "flavors" of dependency injection - each with its own pros and cons. This week, let's take a look at three such flavors and how they can be used in Swift.
Dependency injection is an essential tool when it comes to making code more testable. This week, let's take a look at a dependency injection technique that lets us enable testability without forcing us to write massive initializers or complicated dependency management code.
There seems to almost be a consensus in the community that singletons are "bad", but at the same time both Apple and third party Swift developers keep using them both internally within apps and in shared frameworks. This week, let's take a look at exactly what the problems are with using singletons, and explore some techniques that can be used to avoid them.
Dependency injection is a great technique for decoupling code and making it easier to test. In this article, let’s take a look at how functions can be used for simple dependency injection.