Suggested approach: Dependency injection is the practice of creating an object and telling it what data it should work with, rather than letting that object query its environment to find that data for itself. Although this goes against the OOP principle of encapsulation, it’s worth talking about the advantages – it allows for mocking data when testing, for example.
Estimated difficulty: Intermediate
Watch me answer this question in detail
See the full list of iOS interview questions
Link copied to your pasteboard.