Closed Daniebro5 closed 3 years ago
I could be wrong but if .trigger(OtherRoute.some, on: coordinator)
does not return PageTransition
type which the overridden function is expecting, you're likely going to get an error of this type.
I believe this is because PageTransition is an alias for Transition<UIPageViewController>
and I'm betting that your .trigger(OtherRoute.some, on: coordinator)
returns a NavigationTransition
which doesn't match the expected return type.
Hey @Daniebro5 !
In the line let coordinator = otherCoordinator(rootViewController: self.rootViewController)
, you are trying to create a NavigationCoordinator (or a subclass thereof) with a rootViewController of UIPageViewController
instead of UINavigationController
.
To give a little bit more context:
Each coordinator has a rootViewController it is managing. In the case of a PageCoordinator this is a UIPageViewController, for NavigationCoordinator this is a UINavigationController. When a route is triggered, a transition is created, which is then performed on this exact rootViewController.
Since in your example code, you are trying to create a NavigationCoordinator with a UIPageViewController, the compiler is trying to tell you that not all of the UINavigationController capabilities are available for UIPageViewController (for example pushViewController
).
In a normal case, you would probably simply initialize the NavigationCoordinator without specifying a rootViewController (it will simply create one itself then), or specify one - e.g. let coordinator = otherCoordinator(rootViewController: UINavigationController())
I'm trying to trigger a second coordinator as follows:
But I'm seeing "Cannot convert value of type 'UIPageViewController' to expected argument type 'NavigationCoordinator.RootViewController' (aka 'UINavigationController')". What am I doing wrong?