Essential Developer

View Original

S01E03: [TDD 🍅 2] Swift @escaping Closures and Retain Cycles

Watch on YouTube

In this episode, we continue the development of the Flow as we start progressing to next questions. We accomplish this by providing a closure as the answer callback in the Router protocol.

We discuss about the meaning of placing the @escaping instruction in a protocol and we examine our options for dealing with retain cycles and memory management.

In the test side of things, the RouterSpy is refactored to support multiple questions and it gets an answer callback property, so we can control when a question is being answered from our tests.

Subscribe today to our Youtube channel and catch free new episodes every week and follow along the project's progress on GitHub.