From f70b6a04f52c32712699d7dd34835eef0d944055 Mon Sep 17 00:00:00 2001 From: Elviro Rocca Date: Mon, 19 Feb 2018 17:23:07 +0100 Subject: [PATCH] Renamed "lastModalPresented" to "currentModalPresented" --- NavigationHelperUIKit/ViewController.swift | 8 ++++---- Sources/NavigationHelper/Protocols.swift | 8 ++++---- Sources/NavigationHelper/Transition.swift | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/NavigationHelperUIKit/ViewController.swift b/NavigationHelperUIKit/ViewController.swift index ebfe563..1ac8dd7 100644 --- a/NavigationHelperUIKit/ViewController.swift +++ b/NavigationHelperUIKit/ViewController.swift @@ -19,7 +19,7 @@ extension UIViewController: ModalPresenter { return Reader>.unfold { presentable in guard let viewController = presentable.asViewController else { return .pure(()) } - if let lastModalPresented = self.lastModalPresented, let shownPresenter = lastModalPresented as? ModalPresenter { + if let currentModalPresented = self.currentModalPresented, let shownPresenter = currentModalPresented as? ModalPresenter { return shownPresenter.show(animated: animated).run(presentable) } @@ -34,9 +34,9 @@ extension UIViewController: ModalPresenter { } public func hide(animated: Bool) -> Future<()> { - guard let lastModalPresented = self.lastModalPresented else { return .pure(()) } + guard let currentModalPresented = self.currentModalPresented else { return .pure(()) } - if let shownPresenter = lastModalPresented as? ModalPresenter, shownPresenter.isPresenting { + if let shownPresenter = currentModalPresented as? ModalPresenter, shownPresenter.isPresenting { return shownPresenter.hide(animated: animated).flatMap { self.hide(animated: animated) } @@ -51,7 +51,7 @@ extension UIViewController: ModalPresenter { .start() } - public var lastModalPresented: Presentable? { + public var currentModalPresented: Presentable? { return presentedViewController } } diff --git a/Sources/NavigationHelper/Protocols.swift b/Sources/NavigationHelper/Protocols.swift index 6b6669c..5c45eef 100644 --- a/Sources/NavigationHelper/Protocols.swift +++ b/Sources/NavigationHelper/Protocols.swift @@ -17,7 +17,7 @@ extension Presentable { } public protocol ModalPresenter { - var lastModalPresented: Presentable? { get } + var currentModalPresented: Presentable? { get } func show(animated: Bool) -> Reader> func hide(animated: Bool) -> Future<()> @@ -25,7 +25,7 @@ public protocol ModalPresenter { extension ModalPresenter { public var isPresenting: Bool { - return lastModalPresented.isNil.not + return currentModalPresented.isNil.not } public func hideAll(animated: Bool) -> Future<()> { @@ -59,8 +59,8 @@ public final class AnyPresenter: Presenter { self.init(modalPresenter: presenter, structuredPresenter: presenter) } - public var lastModalPresented: Presentable? { - return modalPresenter.lastModalPresented + public var currentModalPresented: Presentable? { + return modalPresenter.currentModalPresented } public func show(animated: Bool) -> Reader> { diff --git a/Sources/NavigationHelper/Transition.swift b/Sources/NavigationHelper/Transition.swift index f74d167..dbfad99 100644 --- a/Sources/NavigationHelper/Transition.swift +++ b/Sources/NavigationHelper/Transition.swift @@ -74,7 +74,7 @@ extension Transition: Executable { case .moveTo(let presentable): return presenter.moveTo(animated: self.animation).run(presentable) - case .dismiss(let all) where presenter.lastModalPresented.isNil.not: + case .dismiss(let all) where presenter.currentModalPresented.isNil.not: return all.fold( onTrue: presenter.hideAll(animated: self.animation), onFalse: presenter.hide(animated: self.animation))