ViewController: added forEachController

This commit is contained in:
Peter 2019-04-29 20:26:23 +04:00
parent 44c84bc116
commit cfc191bc16

View File

@ -398,12 +398,19 @@ open class ViewControllerPresentationArguments {
switch context { switch context {
case .current: case .current:
self.presentationContext.present(controller, on: PresentationSurfaceLevel(rawValue: 0), completion: completion) self.presentationContext.present(controller, on: PresentationSurfaceLevel(rawValue: 0), completion: completion)
completion()
case let .window(level): case let .window(level):
self.window?.present(controller, on: level, blockInteraction: blockInteraction, completion: completion) self.window?.present(controller, on: level, blockInteraction: blockInteraction, completion: completion)
} }
} }
public func forEachController(_ f: (ContainableController) -> Bool) {
for (controller, _) in self.presentationContext.controllers {
if !f(controller) {
break
}
}
}
public func presentInGlobalOverlay(_ controller: ViewController, with arguments: Any? = nil) { public func presentInGlobalOverlay(_ controller: ViewController, with arguments: Any? = nil) {
controller.presentationArguments = arguments controller.presentationArguments = arguments
self.window?.presentInGlobalOverlay(controller) self.window?.presentInGlobalOverlay(controller)