Skip to content

Commit 2869624

Browse files
committed
Revert the EmptyView usage when WebImage does not have placeholder, the EmptyView does not respect .frame set from iOS 13.3 :), good Apple
1 parent 67a5ae9 commit 2869624

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

SDWebImageSwiftUI/Classes/WebImage.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import SDWebImage
1212
/// A Image View type to load image from url. Supports static/animated image format.
1313
@available(iOS 13.0, OSX 10.15, tvOS 13.0, watchOS 6.0, *)
1414
public struct WebImage : View {
15+
static var emptyImage = PlatformImage()
1516
var configurations: [(Image) -> Image] = []
1617

1718
var placeholder: AnyView?
@@ -68,7 +69,11 @@ public struct WebImage : View {
6869
if placeholder != nil {
6970
placeholder
7071
} else {
71-
EmptyView()
72+
// Should not use `EmptyView`, which does not respect to the container's frame modifier
73+
// Using a empty image instead for better compatible
74+
configurations.reduce(Image(platformImage: WebImage.emptyImage)) { (previous, configuration) in
75+
configuration(previous)
76+
}
7277
}
7378
}
7479
.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)

0 commit comments

Comments
 (0)