I see what you get with “transitive” protocols, however your error is caused by your associatedtypeVC declaration , as shown in the error.
Unable to infer associated type 'VC' for protocol 'ViewModelType'
, , , , associatedtype.
An associatedtype .
VC associatedtype, , ViewModelType, , VC .
ExampleViewModel , typealias .
viewController ExampleViewControllerType, "inferred"
protocol ViewModelType: class {
associatedtype VC
var viewController: VC! { get set }
}
class ExampleViewModel: ViewModelType {
typealias VC = ExampleViewControllerType
weak var viewController: ExampleViewControllerType!
}
protocol ViewType: class { }
protocol ExampleViewControllerType: ViewType { }
class ExampleViewController: UIViewController, ExampleViewControllerType {
}