Why controller has to call interface on use cases in Clean Architecture
Depending of the size and the complexity of ur project it would be perfectly fine to simply create the use case interactor with new in the controller and use the implementation directly.
However there are a few advantages of using interfaces (input ports):
- Testing: in case u want to unit test ur controller code an interface would allow u to mock away the use case interactor
- Dependencies: in case ur use case interactor has dependencies to domain services or repositories then u want to "wire those up" in ur "main component" and just pass the use case interactor via interface (input port) to the controller
For a more in depth discussion on controllers and presenters pls have a look at my blog post: http://www.plainionist.net/Implementing-Clean-Architecture-Controller-Presenter/
Combining Use Cases/Interactors in Clean Architecture
In my opinion, you should develop the three interactors in order to respect the Single Responsability Principle. If you do that, you increase the maintainability and reutilization of the code, because you could use these interactors separately in other scenarios.
Related Topics
iOS Present Modal View Controller on Startup Without Flash
Xcode Info.Plist Build Variable ${Product_Name:Rfc1034Identifier} Seems Completely Undocumented
How to Only Show Bottom Border of Uitextfield in Swift
Show Datepicker on Textfield Tap
(Null) Libc++Abi.Dylib: Terminate Called Throwing an Exception
Tableview Rounded Corners and Shadow
How to Make Cmake Use Specific Compiler and Flags When Final Compilation Stage Instead of Detection
iOS Facebook Sdk 4.0 Login Error Code 304
Nsdictionaryofvariablebindings Swift Equivalent
Swift: Get All Subviews of a Specific Type and Add to an Array
Cropping Center Square of Uiimage
How to Rearrange Views When Autorotating with Autolayout
How to Get Weekday And/Or Name of Month from a Nsdate Variable
Where Should I Be Setting Autolayout Constraints When Creating Views Programmatically
How to Programmatically Check Support of 'Face Id' and 'Touch Id'
How to Change "Initwithnibname" in Storyboard
Prevent Duplicate Symbols When Building Static Library with Cocoapods