Created
December 5, 2017 22:15
Revisions
-
pixelrevision created this gist
Dec 5, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ extension Sequence { func walk(_ childSelector: (Element) -> [Element], handler: (Element) -> Void) { for item in self { handler(item) let children = childSelector(item) if children.count > 0 { children.walk(childSelector, handler: handler) } } } }