Skip to content

Commit

Permalink
Merge pull request #57 from BottleRocketStudios/containerFix
Browse files Browse the repository at this point in the history
Ensure completion is called at all times in container
  • Loading branch information
wmcginty committed May 10, 2019
2 parents 20676fc + d430400 commit d536e3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

##### Bug Fixes

* None
* Fix a bug where completion wasn't always called when transitioning.
[Will McGinty](https://github.com/willmcginty)
[#57](https://github.com/BottleRocketStudios/iOS-UtiliKit/pull/57)


## 1.4.0 (2019-04-30)
Expand Down
4 changes: 2 additions & 2 deletions Sources/UtiliKit/Container/ContainerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private extension ContainerViewController {
func transition(to destination: UIViewController, completion: ((Bool) -> Void)? = nil) {

//Ensure that the view is loaded, we're not already transitioning and the transition will result in a move
guard isViewLoaded && !isTransitioning, visibleController != destination else { return }
guard isViewLoaded && !isTransitioning, visibleController != destination else { completion?(true); return }
guard let source = visibleController else {

//If we do not already have a visible controller (first launch), skip the animator and contain the child
Expand All @@ -90,7 +90,7 @@ private extension ContainerViewController {
return
}

guard delegate?.containerViewController(self, shouldTransitionFrom: source, to: destination) ?? true else { return }
guard delegate?.containerViewController(self, shouldTransitionFrom: source, to: destination) ?? true else { completion?(false); return }

//Inform the delegate transitioning is set to begin
delegate?.containerViewController(self, didBeginTransitioningFrom: source, to: destination)
Expand Down

0 comments on commit d536e3f

Please sign in to comment.