Various improvements

This commit is contained in:
Ilya Laktyushin
2022-05-11 19:13:58 +04:00
parent ab0ec36112
commit eedfedbfc3
21 changed files with 371 additions and 211 deletions

View File

@@ -554,6 +554,15 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
(self.navigationController as? NavigationController)?.pushViewController(controller)
}
public func replace(with controller: ViewController) {
if let navigationController = self.navigationController as? NavigationController {
var controllers = navigationController.viewControllers
controllers.removeAll(where: { $0 === self })
controllers.append(controller)
navigationController.setViewControllers(controllers, animated: true)
}
}
open func present(_ controller: ViewController, in context: PresentationContextType, with arguments: Any? = nil, blockInteraction: Bool = false, completion: @escaping () -> Void = {}) {
if !(controller is StandalonePresentableController), case .window = context, let arguments = arguments as? ViewControllerPresentationArguments, case .modalSheet = arguments.presentationAnimation, self.navigationController != nil {
controller.navigationPresentation = .modal