1
0

StackLayoutCache.swift 1.4 KB

1234567891011121314151617181920212223242526272829303132
  1. /// The cache's properties are read-only to avoid the possibility of their
  2. /// values getting out of sync with each other (especially when new
  3. /// properties get introduced).
  4. struct StackLayoutCache {
  5. /// The stack's children grouped by priority. May sometimes have all children
  6. /// in a single group due to the stack layout system determining that
  7. /// flexibility/priority will not have an effect on the final layout.
  8. let priorityGroups: [LayoutPriorityGroup]
  9. /// Whether each child is hidden or not. Hidden means zero size *and* doesn't
  10. /// want spacing of its own in the stack.
  11. let isHidden: [Bool]
  12. /// The total amount of spacing used by the stack.
  13. let totalSpacing: Double
  14. /// The total amount of space reserved. Equal to the total amount of spacing
  15. /// plus the sum of the minimum length of each view.
  16. let totalReservedSpace: Double
  17. /// The minimum length of each view.
  18. let minimumLengths: [Double]
  19. /// Whether to redistribute space on commit or not. `true` if and only if the
  20. /// stack was provided a proposed size with an unspecified perpendicular axis.
  21. let redistributeSpaceOnCommit: Bool
  22. /// The initial value of the cache (just a dummy value, shouldn't ever be used).
  23. static let initial = StackLayoutCache(
  24. priorityGroups: [],
  25. isHidden: [],
  26. totalSpacing: 0,
  27. totalReservedSpace: 0,
  28. minimumLengths: [],
  29. redistributeSpaceOnCommit: false
  30. )
  31. }