Created
May 11, 2017 08:55
-
-
Save chriswebb09/1332ee45d54bf1b02b3fa84efd6434e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewTraverser { | |
private func traverseSuperViews(view: UIView) -> [Int : UIView] { | |
var views: [Int: UIView] = [:] | |
var inputView: UIView? = view | |
while inputView != nil { | |
guard let tag = inputView?.tag, let view = inputView else { continue } | |
views[tag] = view | |
inputView = view.superview | |
} | |
return views | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment