Finding the common superview
Given several UIViews, how would you design a function that returns their nearest common superview?
Given several UIViews, how would you design a function that returns their nearest common superview?
Remember the first view's superview chain, then walk up each remaining view's chain and narrow the candidate to the first view you meet (the LCA). Return nil if they never meet because they're in different windows.
UIKitShort answerBasics
How would you write a function that starts at a root view and finds a view matching some…
#view-hierarchy #coding
UIKitShort answerBasics
You're writing a function that finds the nearest common parent of two UIViews. Which data…
#view-hierarchy
ArchitectureShort answerAdvanced
This is a live coding exercise. Without Foundation's NotificationCenter, design and…
#coding
CS fundamentals and algorithmsShort answerAdvanced
You're given a specific UIView instance in an original view hierarchy, plus a copy of…
#view-hierarchy