MVC is the iOS app architecture recommended by Apple. Later, MVVM,MVP and other architectures emerged. The main purpose is to decouple the business logic, presentation, and data levels. Achieve maximum code reuse.
For the MVC architecture, with the increase in the number of modules in the app, the business logic in the controller becomes more and more complex and the amount of code is increasing. A file with thousands of rows is also common. This is a time-consuming thing to do even with Mark's search method.
In this case, we can separate unnecessary code, such as the construction of the view and its child controls, the Uitableview,uicollectionview DataSource method can be a separate class.
1, the view layer can be built into a sub-level to achieve. You can also use the interface + message forwarding second step (forwardtarget:forselector:) to achieve.
2, DataSource method can be used in the third step of message forwarding, forwardinvocation: the implementation of the method is transferred to another class. Why is the Uitableviewdelegate method not also implemented by other methods?
In fact, it is also possible, but Uitableviewdelegate has a click event, preferably put into the controller to achieve, this event response is best done by the controller.
Demo
Https://github.com/wjwdive/BindViewTest
Two ways to Thin CONTROLELR code in IOS