-
Notifications
You must be signed in to change notification settings - Fork 7
ViewControllers
Firstly we always use BaseViewController
as a base class for all UIViewControllers in our apps. Whether you need to define same background for all VCs or change back button, it's always good to have a base class.
We use it for handling navigation bar visibility for example. Set value of hasNavigationBar
in viewDidLoad()
and it will magicaly handle navigation bar hiding/showing 🧙♂️.
Another great thing in our BaseViewController
is init and deinit logging. You can see every new allocated VC in console log (and deallocated too of course). It's very useful for finding memory leaks 😏
New view controllers are created from VC+VM file template which can be found i our templates repo. It generates all required boilerplate code like flowDelegate
definition, init(viewModel: ExampleViewModeling)
or setupBindings()
method.
Our codestyle is indicated in ExampleViewController.swift
. We define whole UI hierarchy in loadView()
(we never ever use storyboards 😬). In viewDidLoad()
we assign delegates (eg. UITableViewDelegate), add actions to buttons and last but not least call setupBindings()
which is the method where UI elements are wired up to viewModel properties.
Continue to ViewModels ➡️