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?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?CS fundamentals and algorithmsShort answerAdvanced
You're given a specific UIView instance in an original view hierarchy, plus a copy of tha…
#view-hierarchy #bfs #dfs
UIKitShort answerAdvanced
Given several UIViews, how would you design a function that returns their nearest common …
#view-hierarchy #coding
CS fundamentals and algorithmsShort answerAdvanced
An image mask comes as an N×M grid where 1 is foreground and 0 is background. How would y…
#bfs #dfs
UIKitShort answerBasics
You're writing a function that finds the nearest common parent of two UIViews. Which data…
#view-hierarchy