Skip to content

Commit 438994f

Browse files
committed
Support the case when UIImage has accessibilityLabel, should use correspond API instead
1 parent d564aa5 commit 438994f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

SDWebImageSwiftUI/Classes/WebImage.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,11 @@ public struct WebImage : View {
162162
if let cgImage = cgImage {
163163
let scale = image.scale
164164
let orientation = image.imageOrientation.toSwiftUI
165-
result = Image(decorative: cgImage, scale: scale, orientation: orientation)
165+
if let label = image.accessibilityLabel {
166+
result = Image(cgImage, scale: scale, orientation: orientation, label: Text(label))
167+
} else {
168+
result = Image(decorative: cgImage, scale: scale, orientation: orientation)
169+
}
166170
} else {
167171
result = Image(uiImage: image)
168172
}

0 commit comments

Comments
 (0)