Skip to content

Commit a74923b

Browse files
committed
Add support for forwarding container view controller methods
1 parent 134afbb commit a74923b

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

Framework/StateViewController.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ FOUNDATION_EXPORT double StateViewControllerVersionNumber;
55

66
//! Project version string for StateViewController.
77
FOUNDATION_EXPORT const unsigned char StateViewControllerVersionString[];
8-
9-
// In this header, you should import all the public headers of your framework using statements like #import <StateViewController/PublicHeader.h>

Sources/StateViewController.swift

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,26 @@ open class StateViewController<State: Equatable>: UIViewController {
249249
endStateTransitionIfNeeded(animated: animated)
250250
}
251251

252+
// MARK: - Container view controller forwarding
253+
254+
open override var childViewControllerForStatusBarStyle: UIViewController? {
255+
return childViewControllers.last
256+
}
257+
258+
open override var childViewControllerForStatusBarHidden: UIViewController? {
259+
return childViewControllers.last
260+
}
261+
262+
@available(iOS 11, *)
263+
open override func childViewControllerForScreenEdgesDeferringSystemGestures() -> UIViewController? {
264+
return childViewControllers.last
265+
}
266+
267+
@available(iOS 11, *)
268+
open override func childViewControllerForHomeIndicatorAutoHidden() -> UIViewController? {
269+
return childViewControllers.last
270+
}
271+
252272
// MARK: - State transitioning
253273

254274
/// Indicates whether the view controller currently is transitioning between states.
@@ -530,6 +550,15 @@ fileprivate extension StateViewController {
530550
addContentViewController(viewController, animated: animated)
531551
}
532552

553+
if adding.isEmpty == false || removing.isEmpty == false {
554+
setNeedsStatusBarAppearanceUpdate()
555+
556+
if #available(iOS 11, *) {
557+
setNeedsUpdateOfHomeIndicatorAutoHidden()
558+
setNeedsUpdateOfScreenEdgesDeferringSystemGestures()
559+
}
560+
}
561+
533562
// Update the hierarchy of the view controllers that will represent the state being transitioned to.
534563
updateHierarchy(of: next)
535564
return true

0 commit comments

Comments
 (0)