From cfc191bc16af3beb4212345ba10e8e36a3b51937 Mon Sep 17 00:00:00 2001 From: Peter <> Date: Mon, 29 Apr 2019 20:26:23 +0400 Subject: [PATCH] ViewController: added forEachController --- Display/ViewController.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Display/ViewController.swift b/Display/ViewController.swift index 636aaf4855..ec37788fcc 100644 --- a/Display/ViewController.swift +++ b/Display/ViewController.swift @@ -398,12 +398,19 @@ open class ViewControllerPresentationArguments { switch context { case .current: self.presentationContext.present(controller, on: PresentationSurfaceLevel(rawValue: 0), completion: completion) - completion() case let .window(level): 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) { controller.presentationArguments = arguments self.window?.presentInGlobalOverlay(controller)