Guest User

Untitled

a guest
Dec 13th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. private func hierarchySize(hierarchy: Hierarchy<String>) -> CGSize {
  2. let firstSize = textSize(hierarchy.value)
  3. var maxWidth = firstSize.width
  4. var sumOfHeights = firstSize.height
  5. for child in hierarchy.children {
  6. let childSize = hierarchySize(hierarchy: child)
  7. maxWidth = max(maxWidth, indentSize + childSize.width)
  8. sumOfHeights += rowSpacing + childSize.height
  9. }
  10. return CGSize(width: maxWidth, height: sumOfHeights)
  11. }
Add Comment
Please, Sign In to add comment