From f5ac2616ad5ecc63b28555e90b54b8f4862db6ce Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 7 Jun 2022 09:42:33 -0400 Subject: [PATCH] Disable unnecessary UIAppearance hacks on iOS 16 --- Tusker/Screens/Compose/ComposeAttachmentsList.swift | 12 ++++++++---- .../Preferences/OppositeCollapseKeywordsView.swift | 6 +++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Tusker/Screens/Compose/ComposeAttachmentsList.swift b/Tusker/Screens/Compose/ComposeAttachmentsList.swift index 084ecadc..b83e39ab 100644 --- a/Tusker/Screens/Compose/ComposeAttachmentsList.swift +++ b/Tusker/Screens/Compose/ComposeAttachmentsList.swift @@ -110,10 +110,14 @@ struct ComposeAttachmentsList: View { } private func didAppear() { - let proxy = UITableView.appearance(whenContainedInInstancesOf: [ComposeHostingController.self]) - // enable drag and drop to reorder on iPhone - proxy.dragInteractionEnabled = true - proxy.isScrollEnabled = false + if #available(iOS 16.0, *) { + // these appearance proxy hacks are no longer necessary + } else { + let proxy = UITableView.appearance(whenContainedInInstancesOf: [ComposeHostingController.self]) + // enable drag and drop to reorder on iPhone + proxy.dragInteractionEnabled = true + proxy.isScrollEnabled = false + } } private func attachmentsChanged(attachments: [CompositionAttachment]) { diff --git a/Tusker/Screens/Preferences/OppositeCollapseKeywordsView.swift b/Tusker/Screens/Preferences/OppositeCollapseKeywordsView.swift index 1bff11b3..e8be84d0 100644 --- a/Tusker/Screens/Preferences/OppositeCollapseKeywordsView.swift +++ b/Tusker/Screens/Preferences/OppositeCollapseKeywordsView.swift @@ -46,7 +46,11 @@ struct OppositeCollapseKeywordsView: View { } private func updateAppearance() { - UIScrollView.appearance(whenContainedInInstancesOf: [PreferencesNavigationController.self]).keyboardDismissMode = .interactive + if #available(iOS 16.0, *) { + // no longer necessary + } else { + UIScrollView.appearance(whenContainedInInstancesOf: [PreferencesNavigationController.self]).keyboardDismissMode = .interactive + } } private func commitExisting(at index: Int) -> () -> Void {