1
0

ContentMode.swift 615 B

123456789101112131415161718
  1. /// How a view fills the available space.
  2. public enum ContentMode: Sendable {
  3. /// Resize the content so that it takes up all available space while
  4. /// maintaining aspect ratio.
  5. case fill
  6. /// Resize the content so that it takes up as much of the available space
  7. /// as possible while staying within its bounds and maintaining aspect ratio.
  8. case fit
  9. /// An internal helper used when sizing a frame based of its child instead
  10. /// of the other way around.
  11. var opposite: ContentMode {
  12. switch self {
  13. case .fill: .fit
  14. case .fit: .fill
  15. }
  16. }
  17. }