Zuikyo / ZIKRouter

Interface-oriented router for discovering modules, and injecting dependencies with protocol in Objective-C and Swift.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

大佬,看看这个问题怎么办

imphila opened this issue · comments

Return expression of type 'UIViewController' does not conform to 'ZIKViewRouteContainer'
WX20200624-173734@2x

let url = "abc://bvc/a?apple=1"
let b = ZIKViewRouter<UIViewController, ZIKViewRouteConfiguration>.router(forURL: url)
b?.perform(ZIKViewRoutePath.push(from: self), configuring: { (config) in

        config.containerWrapper = { vc in
            vc.modalPresentationStyle = .overFullScreen
            return vc
        }
        
    })
commented

Read the documentation of containerWrapper. You should wrap the vc in a container (UINavigationController, UITabBarController or UISplitViewController), and return the container.

commented

If you only need to change vc.modalPresentationStyle, you should do it in prepareDestination.

let router = ZIKAnyViewRouter.router(forURL: "abc://bvc/a?apple=1")
router?.perform(.push(from: self), configuring: { (config) in
    config.prepareDestination = { [weak self] destination in
        if let destination = destination as? UIViewController {
            destination.modalPresentationStyle = .fullScreen
        }
    }
})

Get it. Thank you