This repository contains demonstration code for my Medium article iOS Unit Tests and Asynchronous Calls.
A simple class Delayer
using DispatchQueue.main.asyncAfter
is refactored to allow better unit testing.
The refactoring is done twice, first with ReactiveSwift
, second with Combine
. The ReactiveSwift
part uses a global variable to access the TestScheduler
, the Combine
part uses Constructor Injection.