Skip to content

Commit b002494

Browse files
committed
Make Image Sendable
1 parent d82cd00 commit b002494

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Sources/SwiftCrossUI/Views/Image.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Foundation
2-
import ImageFormats
2+
@preconcurrency 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)