| 123456789101112131415161718192021222324252627282930 |
- import Foundation
- /// A view that displays an image.
- public struct Image: Sendable {
- /// Whether the image is resizable.
- private var isResizable = false
- /// Creates an image view.
- ///
- /// `png`, `jpg`, and `webp` are supported.
- ///
- /// - Parameters:
- /// - url: The URL of the file to display.
- /// - useFileExtension: If `true`, the file extension is used to determine
- /// the file type, otherwise the first few ('magic') bytes of the file
- /// are used.
- public init(_ url: URL, useFileExtension: Bool = true) {}
- /// Makes the image resize to fit the available space.
- public func resizable() -> Self {
- var image = self
- image.isResizable = true
- return image
- }
- }
- extension Image: View {
- public var body: some View { return EmptyView() }
- }
|