Go to file
Ivan Smolin f5bc3f6cc7 Merge pull request 'update repo path in podspec' (#2) from fix/podspec_url_update into master
Reviewed-on: #2
2023-12-05 12:30:22 +03:00
Example Release 1.0.0 2020-03-15 17:12:12 +03:00
TICoordinatorKit fix iOS 12 behavior when calling dismiss without presentedController, add withAnimationCompletion for StackRoutable 2023-12-04 18:06:04 +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 build on xcode 11 2020-11-10 12:14:23 +03:00
README.md Add "Supporting custom navigation controllers" to README 2020-03-31 14:57:53 +03:00
TICoordinatorKit.podspec update repo path in podspec 2023-12-05 12:27:32 +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.