Skip to content

Commit

Permalink
Renamed "lastModalPresented" to "currentModalPresented"
Browse files Browse the repository at this point in the history
  • Loading branch information
Elviro Rocca committed Feb 19, 2018
1 parent ed432b6 commit f70b6a0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions NavigationHelperUIKit/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ extension UIViewController: ModalPresenter {
return Reader<Presentable, Future<()>>.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)
}

Expand All @@ -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)
}
Expand All @@ -51,7 +51,7 @@ extension UIViewController: ModalPresenter {
.start()
}

public var lastModalPresented: Presentable? {
public var currentModalPresented: Presentable? {
return presentedViewController
}
}
8 changes: 4 additions & 4 deletions Sources/NavigationHelper/Protocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ extension Presentable {
}

public protocol ModalPresenter {
var lastModalPresented: Presentable? { get }
var currentModalPresented: Presentable? { get }

func show(animated: Bool) -> Reader<Presentable,Future<()>>
func hide(animated: Bool) -> Future<()>
}

extension ModalPresenter {
public var isPresenting: Bool {
return lastModalPresented.isNil.not
return currentModalPresented.isNil.not
}

public func hideAll(animated: Bool) -> Future<()> {
Expand Down Expand Up @@ -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<Presentable, Future<()>> {
Expand Down
2 changes: 1 addition & 1 deletion Sources/NavigationHelper/Transition.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit f70b6a0

Please sign in to comment.