Go to file
Ivan Smolin 01004bf0cf
Merge pull request #4 from TouchInstinct/feature/SPM
add SPM support
2020-10-20 16:03:27 +03:00
Example Release 1.0.0 2020-03-15 17:12:12 +03:00
TICoordinatorKit Set headModule when setting RootRouter's root module 2020-04-22 17:54:56 +03:00
.gitignore add SPM support 2020-10-20 15:48:31 +03:00
.travis.yml Initial commit 2020-03-15 16:42:01 +03:00
LICENSE Release 1.0.0 2020-03-15 17:12:12 +03:00
Package.swift fix review notes 2020-10-20 15:58:59 +03:00
README.md Add "Supporting custom navigation controllers" to README 2020-03-31 14:57:53 +03:00
TICoordinatorKit.podspec Update version to 1.1.1 2020-04-22 17:57:21 +03:00
_Pods.xcodeproj Initial commit 2020-03-15 16:42:01 +03:00

README.md

TICoordinatorKit

A framework for performing navigation in iOS application.

Supporting custom navigation controllers

In ModalRoutable protocol there is a group of methods called presentChild:

presentChild(_:navigationControllerFactory:) -> StackRoutable?
presentChild(_:navigationControllerFactory:animated:) -> StackRoutable?

These methods wrap given module in navigation controller and present the wrapper. The navigationControllerFactory argument is a closure of type (UIViewController) -> UINavigationController. For example:

router.presentChild(module, 
                    navigationControllerFactory: { 
                      UINavigationController(rootViewController: $0) 
                    }, 
                    animated: true)

To simplify this method call (or in case your application has custom implementation of UINavigationController), you may consider creating a standalone NavigationControllerFactory:

// ModalRoutable+NavigationControllerFactory.swift
import TICoordinatorKit

extension ModalRoutable {

    // MARK: - Navigation Controller Factory

    private var factory: ModalRoutable.NavigationControllerFactory {

        return { 
            CustomNavigationController(rootViewController: $0)
        }
    }

    // MARK: - Defaults

    func presentChild(_ module: Presentable?) -> StackRoutable? {
        return presentChild(module, navigationControllerFactory: factory)
    }

    func presentChild(_ module: Presentable?, animated: Bool) -> StackRoutable? {
        return presentChild(module, navigationControllerFactory: factory, animated: animated)
    }
}

License

See the LICENSE file for more info.