Controller, easy! We take out the code in UIView

 3r???. 3r3-31. Do you have a big UIViewController? For many, yes. On the one hand, it works with data, on the other - with the interface. 3r3499.  3r???. 3r3499.  3r???. The tasks of separating logic from an interface are described in hundreds of articles about architecture: MVP, MVVM, VIPER. They solve the problem of data flow, but do not answer the question of how to work with the interface: in one place remains the creation of elements, layout, configuration, input processing and animation. 3r3499.  3r???. 3r3499.  3r???. Let's separate the view from the controller and see what loadView () will help us with. 3r3499.  3r???. 3r3499.  3r???. 3r314. 3r3499.  3r???. In the example on GitHub You can look at the division of classes for a simple task: the color of the square depends on its position (in the green area it is green, outside it is red). 3r3499.  3r???. 3r3499.  3r???. The more complex the screen, the better the effect: the controller decreases, the code is transferred to its places. The code is simply transferred to r3r3501. view but encapsulation simplifies communication and code reading. Sometimes view can be reused with another controller. For example, different controllers for the iPhone and iPad react differently to the appearance of the keyboard, but this does not change the code view . 3r3499.  3r???. 3r3499.  3r???. I used this code in different projects and with different people, each time the team welcomed the simplification and picked up the practice. I hope you enjoy it too. All lung r3r3501. UIViewController ! 3r? 3510. 3r???. 3r???. 3r???.
3r???. 3r? 3510. 3r???. 3r???. 3r???. 3r???.
+ 0 -

Comments 1

Paul P. True
Paul P. True 30 September 2019 12:48
Golf is mostly plays in winter. We call this period, “Weather Relativity` rule. As we gradually come out of the Sun-scorched summer in September, a cloudy, 50 degree day; which we normally feel like we`re visiting Hoth, after three months of winter, those same conditions translate to a trip to the beach. Remember to dress appropriately to protect yourself from cold For More Information.

Add comment