diff --git a/WooCommerce/Classes/Authentication/AuthenticatedWebViewController.swift b/WooCommerce/Classes/Authentication/AuthenticatedWebViewController.swift index 05598d71cab..04d4c5ea597 100644 --- a/WooCommerce/Classes/Authentication/AuthenticatedWebViewController.swift +++ b/WooCommerce/Classes/Authentication/AuthenticatedWebViewController.swift @@ -78,11 +78,7 @@ private extension AuthenticatedWebViewController { func extendContentUnderSafeAreas() { webView.scrollView.clipsToBounds = false - if #available(iOS 15.0, *) { - view.backgroundColor = webView.underPageBackgroundColor - } else { - view.backgroundColor = webView.backgroundColor - } + view.backgroundColor = webView.underPageBackgroundColor } func configureProgressBar() { diff --git a/WooCommerce/Classes/Authentication/WebAuth/WebKitViewController.swift b/WooCommerce/Classes/Authentication/WebAuth/WebKitViewController.swift index 0b1b82a78cc..e7d5f93b8f3 100644 --- a/WooCommerce/Classes/Authentication/WebAuth/WebKitViewController.swift +++ b/WooCommerce/Classes/Authentication/WebAuth/WebKitViewController.swift @@ -272,10 +272,7 @@ class WebKitViewController: UIViewController { appearance.backgroundColor = UIColor(light: .white, dark: .gray) toolBar.standardAppearance = appearance - - if #available(iOS 15.0, *) { - toolBar.scrollEdgeAppearance = appearance - } + toolBar.scrollEdgeAppearance = appearance fixBarButtonsColorForBoldText(on: toolBar) } diff --git a/WooCommerce/Classes/Extensions/UITabBar+Appearance.swift b/WooCommerce/Classes/Extensions/UITabBar+Appearance.swift index 20c780ca68e..1233b92bfb7 100644 --- a/WooCommerce/Classes/Extensions/UITabBar+Appearance.swift +++ b/WooCommerce/Classes/Extensions/UITabBar+Appearance.swift @@ -24,9 +24,7 @@ extension UITabBar { /// This is needed because the tab bar background has the wrong color under iOS 15 (using Xcode 13). /// More: issue-5018 /// - if #available(iOS 15.0, *) { - appearance.scrollEdgeAppearance = appearance.standardAppearance - } + appearance.scrollEdgeAppearance = appearance.standardAppearance } /// Creates an appearance object for a tabbar with the default WC style. diff --git a/WooCommerce/Classes/Extensions/UIViewController+Helpers.swift b/WooCommerce/Classes/Extensions/UIViewController+Helpers.swift index 1e31fb8790a..8bcf2261bb4 100644 --- a/WooCommerce/Classes/Extensions/UIViewController+Helpers.swift +++ b/WooCommerce/Classes/Extensions/UIViewController+Helpers.swift @@ -15,11 +15,7 @@ extension UIViewController { /// Removes the text of the navigation bar back button in the next view controller of the navigation stack. /// func removeNavigationBackBarButtonText() { - if #available(iOS 14.0, *) { - navigationItem.backButtonDisplayMode = .minimal - } else { - navigationItem.backBarButtonItem = UIBarButtonItem(image: UIImage(), style: .plain, target: nil, action: nil) - } + navigationItem.backButtonDisplayMode = .minimal } /// Show the X close button or a custom close button with title on the left bar button item position diff --git a/WooCommerce/Classes/Styles/Style.swift b/WooCommerce/Classes/Styles/Style.swift index 445d1c9ba0b..7a913a55443 100644 --- a/WooCommerce/Classes/Styles/Style.swift +++ b/WooCommerce/Classes/Styles/Style.swift @@ -59,16 +59,10 @@ final class StyleManager { private extension StyleManager { class func fontForTextStyle(_ style: UIFont.TextStyle, weight: UIFont.Weight, maximumPointSize: CGFloat = maxFontSize) -> UIFont { let traits = [UIFontDescriptor.TraitKey.weight: weight] - if #available(iOS 11, *) { - var fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: style) - fontDescriptor = fontDescriptor.addingAttributes([.traits: traits]) - let fontToGetSize = UIFont(descriptor: fontDescriptor, size: CGFloat(0.0)) - return UIFontMetrics(forTextStyle: style).scaledFont(for: fontToGetSize, maximumPointSize: maximumPointSize) - } - - var scaledFontDescriptor = fontDescriptor(style, maximumPointSize: maximumPointSize) - scaledFontDescriptor = scaledFontDescriptor.addingAttributes([.traits: traits]) - return UIFont(descriptor: scaledFontDescriptor, size: CGFloat(0.0)) + var fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: style) + fontDescriptor = fontDescriptor.addingAttributes([.traits: traits]) + let fontToGetSize = UIFont(descriptor: fontDescriptor, size: CGFloat(0.0)) + return UIFontMetrics(forTextStyle: style).scaledFont(for: fontToGetSize, maximumPointSize: maximumPointSize) } diff --git a/WooCommerce/Classes/View Modifiers/View+AutofocusTextModifier.swift b/WooCommerce/Classes/View Modifiers/View+AutofocusTextModifier.swift index 43944cd7f79..864ce5789d2 100644 --- a/WooCommerce/Classes/View Modifiers/View+AutofocusTextModifier.swift +++ b/WooCommerce/Classes/View Modifiers/View+AutofocusTextModifier.swift @@ -2,7 +2,6 @@ import SwiftUI /// Autofocus for `TextField` and `TextEditor` in iOS 15 and later /// -@available(iOS 15.0, *) struct AutofocusTextModifier: ViewModifier { @FocusState private var textFieldIsFocused: Bool @@ -27,14 +26,6 @@ extension View { /// Autofocus in `TextField` and `TextEditor` is available only for iOS15+ /// func focused() -> some View { - // Conditional check has to be done inside the Group function builder, - // otherwise the iOS 15 modifier will be loaded into memory and the app will crash. - Group { - if #available(iOS 15.0, *) { - self.modifier(AutofocusTextModifier()) - } else { - self - } - } + modifier(AutofocusTextModifier()) } } diff --git a/WooCommerce/Classes/ViewRelated/Coupons/CouponListViewController.swift b/WooCommerce/Classes/ViewRelated/Coupons/CouponListViewController.swift index ca197ce6bd6..14b90c979d4 100644 --- a/WooCommerce/Classes/ViewRelated/Coupons/CouponListViewController.swift +++ b/WooCommerce/Classes/ViewRelated/Coupons/CouponListViewController.swift @@ -154,12 +154,8 @@ final class CouponListViewController: UIViewController, GhostableViewController snapshot.appendSections([.main]) snapshot.appendItems(viewModels, toSection: Section.main) - if #available(iOS 15.0, *) { - // minimally reloads the list without computing diff or animation - self.dataSource.applySnapshotUsingReloadData(snapshot) - } else { - self.dataSource.apply(snapshot) - } + // minimally reloads the list without computing diff or animation + self.dataSource.applySnapshotUsingReloadData(snapshot) } .store(in: &subscriptions) diff --git a/WooCommerce/Classes/ViewRelated/Dashboard/MyStore/TopPerformerDataViewController.swift b/WooCommerce/Classes/ViewRelated/Dashboard/MyStore/TopPerformerDataViewController.swift index 12efc75314b..1de7f532750 100644 --- a/WooCommerce/Classes/ViewRelated/Dashboard/MyStore/TopPerformerDataViewController.swift +++ b/WooCommerce/Classes/ViewRelated/Dashboard/MyStore/TopPerformerDataViewController.swift @@ -128,9 +128,7 @@ private extension TopPerformerDataViewController { tableView.applyFooterViewForHidingExtraRowPlaceholders() // Removes extra top padding in iOS 15+. - if #available(iOS 15.0, *) { - tableView.sectionHeaderTopPadding = 0 - } + tableView.sectionHeaderTopPadding = 0 } func configureResultsController() { diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Creation/CustomerSection/OrderCustomerSection.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Creation/CustomerSection/OrderCustomerSection.swift index fa90638c87c..8833e617f21 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Creation/CustomerSection/OrderCustomerSection.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Creation/CustomerSection/OrderCustomerSection.swift @@ -135,7 +135,6 @@ private extension OrderCustomerSectionContent { } } -@available(iOS 15.0, *) struct OrderCustomerSection_Previews: PreviewProvider { static var previews: some View { let emptyViewModel = EditableOrderViewModel.CustomerDataViewModel(billingAddress: nil, shippingAddress: nil) diff --git a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Issue Refunds/IssueRefundCoordinatingController.swift b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Issue Refunds/IssueRefundCoordinatingController.swift index c6062d21615..17795e66237 100644 --- a/WooCommerce/Classes/ViewRelated/Orders/Order Details/Issue Refunds/IssueRefundCoordinatingController.swift +++ b/WooCommerce/Classes/ViewRelated/Orders/Order Details/Issue Refunds/IssueRefundCoordinatingController.swift @@ -134,12 +134,6 @@ private extension IssueRefundCoordinatingController { let viewProperties = InProgressViewProperties(title: Localization.issuingRefund, message: "") let inProgressViewController = InProgressViewController(viewProperties: viewProperties) - // Before iOS 13, a modal with transparent background requires certain - // `modalPresentationStyle` to prevent the view from turning dark after being presented. - if #available(iOS 13.0, *) {} else { - inProgressViewController.modalPresentationStyle = .overCurrentContext - } - present(inProgressViewController, animated: true) } diff --git a/WooCommerce/Classes/ViewRelated/ReusableViews/DatePickerTableViewCell.swift b/WooCommerce/Classes/ViewRelated/ReusableViews/DatePickerTableViewCell.swift index 04848f61b82..226d7b1116d 100644 --- a/WooCommerce/Classes/ViewRelated/ReusableViews/DatePickerTableViewCell.swift +++ b/WooCommerce/Classes/ViewRelated/ReusableViews/DatePickerTableViewCell.swift @@ -33,11 +33,7 @@ extension DatePickerTableViewCell { } static func getDefaultCellHeight() -> CGFloat { - if #available(iOS 14, *) { - return CGFloat(50) - } - - return CGFloat(216) + return CGFloat(50) } } @@ -47,8 +43,6 @@ private extension DatePickerTableViewCell { } func configureDatePicker() { - if #available(iOS 14, *) { - picker.preferredDatePickerStyle = .compact - } + picker.preferredDatePickerStyle = .compact } } diff --git a/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/InfiniteScrollIndicator.swift b/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/InfiniteScrollIndicator.swift index 539aa281513..a45ec962b5d 100644 --- a/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/InfiniteScrollIndicator.swift +++ b/WooCommerce/Classes/ViewRelated/ReusableViews/SwiftUI Components/InfiniteScrollIndicator.swift @@ -6,12 +6,8 @@ struct InfiniteScrollIndicator: View { let showContent: Bool var body: some View { - if #available(iOS 15.0, *) { - createProgressView() - .listRowSeparator(.hidden, edges: .bottom) - } else { - createProgressView() - } + createProgressView() + .listRowSeparator(.hidden, edges: .bottom) } @ViewBuilder func createProgressView() -> some View { diff --git a/WooCommerce/StoreWidgets/Homescreen/StoreInfoView.swift b/WooCommerce/StoreWidgets/Homescreen/StoreInfoView.swift index cae14b7286a..ce4c48a11af 100644 --- a/WooCommerce/StoreWidgets/Homescreen/StoreInfoView.swift +++ b/WooCommerce/StoreWidgets/Homescreen/StoreInfoView.swift @@ -29,13 +29,7 @@ private struct StoreInfoView: View { @Environment(\.sizeCategory) var category var accessibilityCategory: ContentSizeCategory { - if #available(iOS 15.0, *) { - return .extraLarge - } else { - // iOS 14 has margins issue with extraLarge text size, so fallback to accessibility style earlier - // https://github.com/woocommerce/woocommerce-ios/issues/7797 - return .large - } + return .extraLarge } var body: some View {