AdvancedNavigationController 1.3.0

AdvancedNavigationController 1.3.0

Gero Embser 维护。



  • 作者:
  • Gero Embser

AdvancedNavigationController

安装

推荐使用 CocoaPods 进行安装。

要在CocoaPods中集成AdvancedNavigationController到您的项目,请在Podfile中指定它

pod 'AdvancedNavigationController'

用法

请参考该仓库中包含的示例项目

//Create instance and use it
let nc = AdvancedNavigationController()

let willShowEventHandler = nc.add(willShowEventAction: { (showingViewController) in
    //do something with the ViewController that is about to go on screen (but not yet finally visible until didShow occurred)
})

let didShowEventHandler = nc.add(didShowEventAction: { (showedViewController) in
    //do something with the ViewController that was shown (i. e. now visible on screen)
})

let willPopEventHandler = nc.add(willPopEventAction: { (poppingViewController) in
    //do something with the ViewController that is about to popped from screen
    //Note: it is possible that popping is interrupted (e.g. by interactive swipe back)
})

let didPopEventHandler = nc.add(didPopEventAction: { (poppedViewController) in
    //do something with the ViewController that was popped from screen
})

//Note: we use `_` (underscore) here to discard the result, because for the whole lifetime of the `nc` instance, we're interested in doing a specific action when pushing occurs
_ = nc.add(willPushEventAction: { (pushingViewController) in
    //do something with the ViewController that is about to be pushed on screen
})
_ = nc.add(didPushEventAction: { (pushedViewController) in
    //do something with the ViewController that was pushed on screen
})

//after a specific event, we can remove the added event handlers, to no longer perform the specified actions
nc.remove(eventHandlers:[willShowEventHandler, willPopEventHandler])

示例

这是示例应用程序... 示例应用程序动画GIF

许可

该项目受MIT许可支持 - 有关详细信息,请参阅LICENSE文件