Skip to content

Commit 0d0a2a8

Browse files
committed
Make Image Sendable
use concurrency-annotated version of ImageFormats
1 parent 2571549 commit 0d0a2a8

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ let package = Package(
9696
),
9797
.package(
9898
url: "https://github.com/stackotter/swift-image-formats",
99-
.upToNextMinor(from: "0.3.2")
99+
.upToNextMinor(from: "0.3.3")
100100
),
101101
.package(
102102
url: "https://github.com/stackotter/swift-windowsappsdk",

Sources/SwiftCrossUI/Views/Image.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Foundation
22
import ImageFormats
33

44
/// A view that displays an image.
5-
public struct Image: TypeSafeView, View {
5+
public struct Image: Sendable {
66
private var isResizable = false
77
private var source: Source
88

@@ -11,8 +11,6 @@ public struct Image: TypeSafeView, View {
1111
case image(ImageFormats.Image<RGBA>)
1212
}
1313

14-
public var body = EmptyView()
15-
1614
/// Displays an image file. `png`, `jpg`, and `webp` are supported.
1715
/// - Parameters:
1816
/// - url: The url of the file to display.
@@ -39,7 +37,13 @@ public struct Image: TypeSafeView, View {
3937
self.source = source
4038
self.isResizable = resizable
4139
}
40+
}
41+
42+
extension Image: View {
43+
public var body: some View { return EmptyView() }
44+
}
4245

46+
extension Image: TypeSafeView {
4347
func layoutableChildren<Backend: AppBackend>(
4448
backend: Backend,
4549
children: _ImageChildren

0 commit comments

Comments
 (0)