Daily iOS
UIKit

View hierarchy traversal

How would you write a function that starts at a root view and finds a view matching some condition (say, tag == 99 or a specific type)?

func findView(in root: UIView, where predicate: (UIView) -> Bool) -> UIView?

Submit