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 {
138
138
// ensure CGImage is nil
139
139
if image. cgImage == nil {
140
140
// 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)
142
147
image. draw ( at: . zero)
143
148
cgImage = UIGraphicsGetImageFromCurrentImageContext ( ) ? . cgImage
144
149
UIGraphicsEndImageContext ( )
@@ -154,11 +159,7 @@ public struct WebImage : View {
154
159
if let cgImage = cgImage {
155
160
let scale = image. scale
156
161
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)
162
163
} else {
163
164
result = Image ( uiImage: image)
164
165
}
You can’t perform that action at this time.
0 commit comments