How to Replace Real Objects with Fakes in Swift

A test double is like a stunt double. When using a real object is unhelpful, it's good for a test to substitute a fake. But how do we do this in Swift?