Skip to content

Commit bab5908

Browse files
committed
Fix Edit feature attachments.
1 parent ea754d4 commit bab5908

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Shared/Samples/Edit feature attachments/EditFeatureAttachmentsView.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,14 @@ private extension EditFeatureAttachmentsView {
163163

164164
private extension EditFeatureAttachmentsView {
165165
struct AttachmentView: View {
166-
// The attachment that is being displayed.
166+
/// The attachment that is being displayed.
167167
let attachment: Attachment
168-
// The closure called when the delete button is tapped.
168+
/// The closure called when the delete button is tapped.
169169
let onDelete: ((Attachment) -> Void)
170-
// The image in the attachment.
170+
/// The image in the attachment.
171171
@State private var image: Image?
172+
/// The image to show if an image cannot be created from the attachment's data.
173+
private let warningImage = Image(systemName: "exclamationmark.triangle")
172174

173175
var body: some View {
174176
HStack {
@@ -181,7 +183,7 @@ private extension EditFeatureAttachmentsView {
181183
if let uiImage = UIImage(data: result) {
182184
image = Image(uiImage: uiImage)
183185
} else {
184-
image = Image(systemName: "exclamationmark.triangle")
186+
image = warningImage
185187
}
186188
}
187189
} label: {
@@ -194,6 +196,7 @@ private extension EditFeatureAttachmentsView {
194196
Image(systemName: "arrow.down.circle.fill")
195197
}
196198
}
199+
.disabled(image != nil && image != warningImage)
197200
}
198201
.swipeActions {
199202
Button("Delete") {

0 commit comments

Comments
 (0)