I'd like to override descendant property, because I want to use methods from TestViewModel
class directly without casting ViewModel
to TestViewModel
.
As I suppose it's not possible. Could you advise some nice solution. Code and error below:
class ViewModel {
}
class View: UIView {
weak var viewModel: ViewModel!
}
class TestViewModel {
}
class TestView: View {
weak var viewModel: TestViewModel! // error here
}
Got this error:
/Users/evgeniirtishchev/Documents/Development/rdfuturesales/RDProject/View/Identification/IdentificationView.swift:12:26: Cannot override mutable property 'viewModel' of type 'ViewModel!' with covariant type 'IdentificationViewModel!'