Given two views, write an algorithm to find the closest common super-view if one exists.
Anonymous
func getCommonParent(v2: UIView, v2:UIView) -> UIView? { while(v1.parent != null){ let p1 = v1.parent while(v2.parent != null){ let p2 = v2.parent if(p1 == p2) return p1 getCommonParent(p1, p2) } } return nil }
Check out your Company Bowl for anonymous work chats.