Daily iOS
Architecture

Dependency injection

Why do we do dependency injection in an iOS app?

How would an interviewer hear this answer? You'll see whether they'd move on, dig in, or say no, and which sentences would trip you up. Your score doesn't change.
See the short answer

An object receives its dependencies from outside instead of creating them itself, which lets you swap implementations (test doubles), lowers coupling, and puts creation in one place.

Share a question