diff --git a/Tusker/Screens/Compose/ComposeAttachmentRow.swift b/Tusker/Screens/Compose/ComposeAttachmentRow.swift index 3254b10e..0afbbe7f 100644 --- a/Tusker/Screens/Compose/ComposeAttachmentRow.swift +++ b/Tusker/Screens/Compose/ComposeAttachmentRow.swift @@ -46,6 +46,8 @@ struct ComposeAttachmentRow: View { Label("Delete", systemImage: "trash") } } + } previewIfAvailable: { + ComposeAttachmentImage(attachment: attachment, fullSize: true) } switch mode { @@ -151,6 +153,17 @@ extension ComposeAttachmentRow { } } +private extension View { + @ViewBuilder + func contextMenu(@ViewBuilder menuItems: () -> M, @ViewBuilder previewIfAvailable preview: () -> P) -> some View { + if #available(iOS 16.0, *) { + self.contextMenu(menuItems: menuItems, preview: preview) + } else { + self.contextMenu(menuItems: menuItems) + } + } +} + //struct ComposeAttachmentRow_Previews: PreviewProvider { // static var previews: some View { // ComposeAttachmentRow()