diff --git a/Tusker/Screens/Compose/ComposeView.swift b/Tusker/Screens/Compose/ComposeView.swift index 164caba0..1d178f3a 100644 --- a/Tusker/Screens/Compose/ComposeView.swift +++ b/Tusker/Screens/Compose/ComposeView.swift @@ -128,7 +128,7 @@ struct ComposeView: View { } }) .sheet(isPresented: $uiState.isShowingDraftsList) { - DraftsView(currentDraft: draft, mastodonController: mastodonController) + DraftsRepresentable(currentDraft: draft, mastodonController: mastodonController) } .actionSheet(isPresented: $uiState.isShowingSaveDraftSheet, content: self.saveAndCloseSheet) .alert(isPresented: $isShowingPostErrorAlert) { diff --git a/Tusker/Screens/Compose/DraftsView.swift b/Tusker/Screens/Compose/DraftsView.swift index e22ff499..4c872566 100644 --- a/Tusker/Screens/Compose/DraftsView.swift +++ b/Tusker/Screens/Compose/DraftsView.swift @@ -8,6 +8,21 @@ import SwiftUI +@available(iOS, obsoleted: 16.0) +struct DraftsRepresentable: UIViewControllerRepresentable { + typealias UIViewControllerType = UIHostingController + + let currentDraft: Draft + let mastodonController: MastodonController + + func makeUIViewController(context: Context) -> UIHostingController { + return UIHostingController(rootView: DraftsView(currentDraft: currentDraft, mastodonController: mastodonController)) + } + + func updateUIViewController(_ uiViewController: UIHostingController, context: Context) { + } +} + struct DraftsView: View { let currentDraft: Draft // don't pass this in via the environment b/c it crashes on macOS (at least, in Designed for iPad mode) since the environment doesn't get propagated through the modal popup window or something @@ -49,8 +64,10 @@ struct DraftsView: View { .map { visibleDrafts[$0] } .forEach { draftsManager.remove($0) } } + .appGroupedListRowBackground() } .listStyle(.plain) + .appGroupedListBackground(container: DraftsRepresentable.UIViewControllerType.self) .navigationTitle(Text("Drafts")) .navigationBarTitleDisplayMode(.inline) .toolbar {