Support the case when UIImage has accessibilityLabel, should use correspond API instead

This commit is contained in:
DreamPiggy 2020-04-15 17:39:27 +08:00
parent d564aa5ca1
commit 438994f1c3
1 changed files with 5 additions and 1 deletions

View File

@ -162,7 +162,11 @@ public struct WebImage : View {
if let cgImage = cgImage {
let scale = image.scale
let orientation = image.imageOrientation.toSwiftUI
result = Image(decorative: cgImage, scale: scale, orientation: orientation)
if let label = image.accessibilityLabel {
result = Image(cgImage, scale: scale, orientation: orientation, label: Text(label))
} else {
result = Image(decorative: cgImage, scale: scale, orientation: orientation)
}
} else {
result = Image(uiImage: image)
}