Files
phranck db8ea40c0a Refactor: Fix SwiftLint warnings and refactor StatusBar to _StatusBarCore pattern
- Fix 80 SwiftLint warnings (159 -> 79): vertical_whitespace, prefer_self_in_static_references, modifier_order, trailing_newline, trailing_whitespace, prefer_for_where, unneeded_synthesized_initializer, redundant_type_annotation, implicit_optional_initialization, superfluous_disable_command, shorthand_optional_binding, syntactic_sugar, empty_string, vertical_whitespace_closing_braces, identifier_name in BadgeModifier
- Refactor StatusBar from direct Renderable to _StatusBarCore pattern (public View with real body wrapping private Renderable core)
2026-02-15 02:35:18 +01:00

37 lines
1.2 KiB
Swift
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 🖥 TUIKit Terminal UI Kit for Swift
// ContentMode.swift
//
// Created by LAYERED.work
// License: MIT
// MARK: - ContentMode
/// Constants that define how a view's content fills the available space.
///
/// Use `ContentMode` with the ``View/aspectRatio(_:contentMode:)`` modifier
/// to control how an image or other content is scaled within its bounds.
///
/// - ``fit``: Scales content to fit within the bounds while preserving
/// the aspect ratio. The content may not fill the entire available space.
/// - ``fill``: Scales content to fill the bounds while preserving
/// the aspect ratio. The content may extend beyond the available space.
///
/// ## Usage
///
/// ```swift
/// Image(.file("photo.png"))
/// .aspectRatio(contentMode: .fit)
///
/// Image(.url("https://example.com/photo.png"))
/// .aspectRatio(16.0/9.0, contentMode: .fill)
/// ```
public enum ContentMode: Sendable, Equatable {
/// Scales content to fit within the parent by maintaining the
/// aspect ratio. The resulting dimensions are always within bounds.
case fit
/// Scales content to fill the parent by maintaining the aspect ratio.
/// The content may extend beyond the bounds along one dimension.
case fill
}