Skip to content

Commit

Permalink
Merge pull request #68 from iosdevzone/master
Browse files Browse the repository at this point in the history
Updated for iOS 11.
  • Loading branch information
tristanhimmelman authored Mar 12, 2018
2 parents 27cbbaf + ad2121a commit 1e66256
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions HidingNavigationBar/HidingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,14 @@ class HidingViewController {
}

// MARK: - Private methods

// Recursively applies an operation to all views in a view hierarchy
fileprivate func applyToViewHierarchy(rootView: UIView, operation: (UIView) -> Void) {
operation(rootView)
rootView.subviews.forEach { view in
applyToViewHierarchy(rootView: view, operation: operation)
}
}

fileprivate func updateSubviewsToAlpha(_ alpha: CGFloat) {
if navSubviews == nil {
Expand All @@ -194,11 +202,10 @@ class HidingViewController {
}
}
}

if let subViews = navSubviews {
for subView in subViews {
subView.alpha = alpha
}
}
navSubviews?.forEach { subView in
applyToViewHierarchy(rootView: subView) { view in
view.alpha = alpha
}
}
}
}

0 comments on commit 1e66256

Please sign in to comment.