Skip to content

Commit 77f21c7

Browse files
committed
Fix the issue that using Image(uiimage:) will result wrong rendering mode in some component like TabbarItem, while using Image(decorative:sclae:orientation:) works well
1 parent 88f2d67 commit 77f21c7

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

Diff for: SDWebImageSwiftUI/Classes/WebImage.swift

+4-11
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ public struct WebImage : View {
123123
#if os(macOS)
124124
result = Image(nsImage: image)
125125
#else
126-
// Fix the SwiftUI.Image rendering issue, like when use EXIF UIImage, the `.aspectRatio` does not works. SwiftUI's Bug :)
127-
// See issue #101
126+
// Fix the SwiftUI.Image rendering issue, like when use EXIF UIImage, the `.aspectRatio` does not works. SwiftUI's Bug :). See #101
127+
// Always prefers `Image(decorative:scale:)` but not `Image(uiImage:scale:) to avoid bug on `TabbarItem`. See #175
128128
var cgImage: CGImage?
129129
// Case 1: Vector Image, draw bitmap image
130130
if image.sd_isVector {
@@ -144,15 +144,8 @@ public struct WebImage : View {
144144
cgImage = image.cgImage
145145
}
146146
} else {
147-
// Case 2: Image with EXIF orientation (only EXIF 5-8 contains bug)
148-
if [.left, .leftMirrored, .right, .rightMirrored].contains(image.imageOrientation) {
149-
// Fixed by Apple in iOS 14+
150-
if #available(iOS 14.0, watchOS 7.0, tvOS 14.0, *) {
151-
// Do nothing
152-
} else {
153-
cgImage = image.cgImage
154-
}
155-
}
147+
// Case 2: EXIF Image and Bitmap Image, prefers CGImage
148+
cgImage = image.cgImage
156149
}
157150
// If we have CGImage, use CGImage based API, else use UIImage based API
158151
if let cgImage = cgImage {

0 commit comments

Comments
 (0)