Issue #318
I do UI in code, and usually separate between View and ViewController.
class ProfileView: UIView {}
class ProfileViewController: UIViewController {
override func loadView() {
self.view = ProfileView()
}
}
But in places where using UIViewController and manage their view controller containment hierarchy is not desired, then we can roll out a normal object to act as the controller.
class ProfileController {
let profileView: ProfileView
init(profileView: ProfileView) {
self.profileView = profileView
}
func update(profile: Profile) {
profileView.nameLabel.text = profile.name
}
}
If the name Controller sounds confusing with UIViewController
, I usually use Handler
, which contains other Handler
to handle logic for view