• Pros • Don’t need to dependency objects to create • Fit view controller with storyboard • Cons • Too difficult to stay simple • Overtime pass to dependency objects
• Default behavior, WithContext return static Context object • In unit test, add extension ViewController.context • Change context object to mock • Easy to mock context because it depend to ContextType • Solve strong dependency to singleton pattern
• Don’t depend to implementations, depend to protocols • DI makes easy and flexible to inject dependency objects • Depending protocols makes easy to change implementations • Fit View Controller with storyboard very much ✨