Most of the view controllers have their own viewModel as SomeViewModel! because that convenience init is used. I think we can remove ! and change convenience init to just init if we change self.init() to super.init(nibName:bundle:) instead. For example, we could do something like this:
private let viewModel: SomeViewModel
init(viewModel: SomeViewModel) {
self.viewModel = viewModel
super.init() // or super.init(nibName: nil, bundle: nil)
}
Something like this would help us prevent the viewModel property getting mutated unintentionally and it'll look safer in my opinion 😁
Most of the view controllers have their own
viewModel
asSomeViewModel!
because thatconvenience init
is used. I think we can remove!
and change convenience init to just init if we changeself.init()
tosuper.init(nibName:bundle:)
instead. For example, we could do something like this:Something like this would help us prevent the viewModel property getting mutated unintentionally and it'll look safer in my opinion 😁