diff --git a/Modules/RSCore/Sources/RSCore/UIKit/UIStoryboard+RSCore.swift b/Modules/RSCore/Sources/RSCore/UIKit/UIStoryboard+RSCore.swift index 77e0abe67..591143adf 100644 --- a/Modules/RSCore/Sources/RSCore/UIKit/UIStoryboard+RSCore.swift +++ b/Modules/RSCore/Sources/RSCore/UIKit/UIStoryboard+RSCore.swift @@ -11,8 +11,6 @@ import UIKit extension UIStoryboard { - static let preferredContentSizeForFormSheetDisplay = CGSize(width: 460.0, height: 400.0) - public static var main: UIStoryboard { UIStoryboard(name: "Main", bundle: nil) } diff --git a/iOS/Add/AddFeedView.swift b/iOS/Add/AddFeedView.swift index fa0c27893..66bf87bcc 100644 --- a/iOS/Add/AddFeedView.swift +++ b/iOS/Add/AddFeedView.swift @@ -12,8 +12,6 @@ import Account /// Sheet for subscribing to a feed by URL, with an optional title and a choice of account or folder. struct AddFeedView: View { - static let preferredContentSizeForFormSheetDisplay = CGSize(width: 460, height: 400) - @Environment(\.dismiss) private var dismiss @State private var urlString = "" @State private var name = "" diff --git a/iOS/Add/AddFolderView.swift b/iOS/Add/AddFolderView.swift index 1dd581ea8..cea24f7c8 100644 --- a/iOS/Add/AddFolderView.swift +++ b/iOS/Add/AddFolderView.swift @@ -12,8 +12,6 @@ import Account /// Sheet for adding a folder to an account. struct AddFolderView: View { - static let preferredContentSizeForFormSheetDisplay = CGSize(width: 460, height: 400) - @Environment(\.dismiss) private var dismiss @State private var name = "" @State private var selectedAccountID = "" diff --git a/iOS/Inspector/AccountInspectorViewController.swift b/iOS/Inspector/AccountInspectorViewController.swift index f9fcbc2c0..e23c34550 100644 --- a/iOS/Inspector/AccountInspectorViewController.swift +++ b/iOS/Inspector/AccountInspectorViewController.swift @@ -13,7 +13,6 @@ import RSCore import Account final class AccountInspectorViewController: UITableViewController { - static let preferredContentSizeForFormSheetDisplay = CGSize(width: 460.0, height: 400.0) @IBOutlet var nameTextField: UITextField! @IBOutlet var activeSwitch: UISwitch! diff --git a/iOS/SceneCoordinator.swift b/iOS/SceneCoordinator.swift index 971d357ff..261975ac6 100644 --- a/iOS/SceneCoordinator.swift +++ b/iOS/SceneCoordinator.swift @@ -1585,7 +1585,7 @@ struct SidebarItemNode: Hashable, Sendable { UIStoryboard.inspector.instantiateViewController(identifier: "AccountInspectorNavigationViewController") as! UINavigationController let accountInspectorController = accountInspectorNavController.topViewController as! AccountInspectorViewController accountInspectorNavController.modalPresentationStyle = .formSheet - accountInspectorNavController.preferredContentSize = AccountInspectorViewController.preferredContentSizeForFormSheetDisplay + accountInspectorNavController.preferredContentSize = UIViewController.formSheetSize accountInspectorController.isModal = true accountInspectorController.account = account rootSplitViewController.present(accountInspectorNavController, animated: true) @@ -1622,7 +1622,7 @@ struct SidebarItemNode: Hashable, Sendable { let addFeedView = AddFeedView(initialFeed: initialFeed, initialFeedName: initialFeedName) let hostingController = UIHostingController(rootView: addFeedView) hostingController.modalPresentationStyle = .formSheet - hostingController.preferredContentSize = AddFeedView.preferredContentSizeForFormSheetDisplay + hostingController.preferredContentSize = UIViewController.formSheetSize // Presenting over an active nav-bar-hosted search bar crashes inside UIKit. guard let mainTimelineViewController else { @@ -1637,7 +1637,7 @@ struct SidebarItemNode: Hashable, Sendable { func showAddFolder() { let hostingController = UIHostingController(rootView: AddFolderView()) hostingController.modalPresentationStyle = .formSheet - hostingController.preferredContentSize = AddFolderView.preferredContentSizeForFormSheetDisplay + hostingController.preferredContentSize = UIViewController.formSheetSize mainFeedCollectionViewController.present(hostingController, animated: true) } diff --git a/iOS/Settings/SettingsViewController.swift b/iOS/Settings/SettingsViewController.swift index 95b4fb24a..97cbb8851 100644 --- a/iOS/Settings/SettingsViewController.swift +++ b/iOS/Settings/SettingsViewController.swift @@ -516,7 +516,7 @@ private extension SettingsViewController { let addFeedView = AddFeedView(initialFeed: AccountManager.netNewsWireNewsURL, initialFeedName: NSLocalizedString("NetNewsWire News", comment: "NetNewsWire News")) let hostingController = UIHostingController(rootView: addFeedView) hostingController.modalPresentationStyle = .formSheet - hostingController.preferredContentSize = AddFeedView.preferredContentSizeForFormSheetDisplay + hostingController.preferredContentSize = UIViewController.formSheetSize presentingParentController?.present(hostingController, animated: true) } diff --git a/iOS/UIKit Extensions/UIViewController+Extras.swift b/iOS/UIKit Extensions/UIViewController+Extras.swift index a56c379c8..caf3bd661 100644 --- a/iOS/UIKit Extensions/UIViewController+Extras.swift +++ b/iOS/UIKit Extensions/UIViewController+Extras.swift @@ -13,6 +13,9 @@ import Account extension UIViewController { + /// Size of form sheets on iPad. + static let formSheetSize = CGSize(width: 460, height: 400) + func presentError(_ error: Error, dismiss: (() -> Void)? = nil) { if let accountError = error as? AccountError, accountError.isCredentialsError { presentAccountError(accountError, dismiss: dismiss)