diff --git a/Framework/StateViewController.h b/Framework/StateViewController.h index a26f28b..8dc96a9 100644 --- a/Framework/StateViewController.h +++ b/Framework/StateViewController.h @@ -5,5 +5,3 @@ FOUNDATION_EXPORT double StateViewControllerVersionNumber; //! Project version string for StateViewController. FOUNDATION_EXPORT const unsigned char StateViewControllerVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import diff --git a/Sources/StateViewController.swift b/Sources/StateViewController.swift index a58acae..85a6dd6 100644 --- a/Sources/StateViewController.swift +++ b/Sources/StateViewController.swift @@ -249,6 +249,26 @@ open class StateViewController: UIViewController { endStateTransitionIfNeeded(animated: animated) } + // MARK: - Container view controller forwarding + + open override var childViewControllerForStatusBarStyle: UIViewController? { + return childViewControllers.last + } + + open override var childViewControllerForStatusBarHidden: UIViewController? { + return childViewControllers.last + } + + @available(iOS 11, *) + open override func childViewControllerForScreenEdgesDeferringSystemGestures() -> UIViewController? { + return childViewControllers.last + } + + @available(iOS 11, *) + open override func childViewControllerForHomeIndicatorAutoHidden() -> UIViewController? { + return childViewControllers.last + } + // MARK: - State transitioning /// Indicates whether the view controller currently is transitioning between states. @@ -530,6 +550,15 @@ fileprivate extension StateViewController { addContentViewController(viewController, animated: animated) } + if adding.isEmpty == false || removing.isEmpty == false { + setNeedsStatusBarAppearanceUpdate() + + if #available(iOS 11, *) { + setNeedsUpdateOfHomeIndicatorAutoHidden() + setNeedsUpdateOfScreenEdgesDeferringSystemGestures() + } + } + // Update the hierarchy of the view controllers that will represent the state being transitioned to. updateHierarchy(of: next) return true