Skip to content

Commit 608b861

Browse files
committed
Fix the behavior again, check the resizable to return super or custom implementation
1 parent 2ad8897 commit 608b861

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

SDWebImageSwiftUI/Classes/ImageViewWrapper.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,12 @@ public class AnimatedImageViewWrapper : PlatformView {
4646
#endif
4747

4848
public override var intrinsicContentSize: CGSize {
49-
/// Used to fix SwiftUI layout issue when image view is aspectFit/aspectFill :)
50-
/// The container will measure its own size with 1:1 firstly, then change image view size, which cause image view sizing smaller than expected
51-
/// Instead, the container should firstly return its own size with image view's aspect ratio
52-
let size = wrapped.intrinsicContentSize
49+
/// Match the behavior of SwiftUI.Image, only when image is resizable, use the super implementation to calculate size
5350
if resizable {
54-
if size.width > 0 && size.height > 0 {
55-
return size
56-
} else {
57-
return super.intrinsicContentSize
58-
}
51+
return super.intrinsicContentSize
5952
} else {
6053
/// Not resizable, always use image size, like SwiftUI.Image
61-
return size
54+
return wrapped.intrinsicContentSize
6255
}
6356
}
6457

0 commit comments

Comments
 (0)