File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
SDWebImageSwiftUI/Classes Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,12 @@ public struct WebImage : View {
138138 // ensure CGImage is nil
139139 if image. cgImage == nil {
140140 // draw vector into bitmap with the screen scale (behavior like AppKit)
141- UIGraphicsBeginImageContextWithOptions ( image. size, false , UIScreen . main. scale)
141+ #if os(iOS) || os(tvOS)
142+ let scale = UIScreen . main. scale
143+ #else
144+ let scale = WKInterfaceDevice . current ( ) . screenScale
145+ #endif
146+ UIGraphicsBeginImageContextWithOptions ( image. size, false , scale)
142147 image. draw ( at: . zero)
143148 cgImage = UIGraphicsGetImageFromCurrentImageContext ( ) ? . cgImage
144149 UIGraphicsEndImageContext ( )
@@ -154,11 +159,7 @@ public struct WebImage : View {
154159 if let cgImage = cgImage {
155160 let scale = image. scale
156161 let orientation = image. imageOrientation. toSwiftUI
157- if let label = image. accessibilityLabel {
158- result = Image ( cgImage, scale: scale, orientation: orientation, label: Text ( label) )
159- } else {
160- result = Image ( decorative: cgImage, scale: scale, orientation: orientation)
161- }
162+ result = Image ( decorative: cgImage, scale: scale, orientation: orientation)
162163 } else {
163164 result = Image ( uiImage: image)
164165 }
You can’t perform that action at this time.
0 commit comments