diff --git a/CHANGELOG.md b/CHANGELOG.md index e33ea03..f03fafa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/Sources/UtiliKit/Container/ContainerViewController.swift b/Sources/UtiliKit/Container/ContainerViewController.swift index c32aa98..5f9e436 100644 --- a/Sources/UtiliKit/Container/ContainerViewController.swift +++ b/Sources/UtiliKit/Container/ContainerViewController.swift @@ -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 @@ -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)