How Does Swift Support Stubbing and Mocking?

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?