Skip to content

Commit 90e82d9

Browse files
committed
Remove redundant #available(iOS 13, *) checks
They always return `true` since the deployment version is 13.0, and will soon become 14.0. Only one has been left, in `WidgetStyles.swift`, because it will change again when bumping the deployment target to 14+.
1 parent 42f29ba commit 90e82d9

File tree

16 files changed

+27
-88
lines changed

16 files changed

+27
-88
lines changed

WordPress/Classes/ViewRelated/Activity/Filter/FilterChipButton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class FilterChipButton: UIView {
9494
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
9595
super.traitCollectionDidChange(previousTraitCollection)
9696

97-
if #available(iOS 13, *), traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
97+
if traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection) {
9898
applyColors()
9999
}
100100
}

WordPress/Classes/ViewRelated/Blog/Blog + Me/GravatarButtonView.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,7 @@ extension GravatarButtonView {
6666
extension GravatarButtonView {
6767

6868
private struct StandardBorder {
69-
static var color: UIColor {
70-
if #available(iOS 13, *) {
71-
return .separator
72-
}
73-
74-
return .gray(.shade20)
75-
}
69+
static var color: UIColor = .separator
7670

7771
static let width = CGFloat(0.5)
7872
}

WordPress/Classes/ViewRelated/Blog/Blogging Reminders/Time Selector/TimeSelectionView.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ class TimeSelectionView: UIView {
88
private lazy var timePicker: UIDatePicker = {
99
let datePicker = UIDatePicker()
1010

11-
if #available(iOS 13.4, *) {
12-
datePicker.preferredDatePickerStyle = .wheels
13-
}
14-
11+
datePicker.preferredDatePickerStyle = .wheels
1512
datePicker.datePickerMode = .time
1613
datePicker.translatesAutoresizingMaskIntoConstraints = false
1714
datePicker.setDate(selectedTime, animated: false)

WordPress/Classes/ViewRelated/Domains/Domain registration/RegisterDomainSuggestions/DomainSuggestionsTableViewController.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,8 @@ class DomainSuggestionsTableViewController: UITableViewController {
118118
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
119119
super.traitCollectionDidChange(previousTraitCollection)
120120

121-
if #available(iOS 13, *) {
122-
if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle {
123-
tableView.reloadData()
124-
}
121+
if traitCollection.userInterfaceStyle != previousTraitCollection?.userInterfaceStyle {
122+
tableView.reloadData()
125123
}
126124
}
127125

WordPress/Classes/ViewRelated/Gutenberg/GutenbergWeb/GutenbergWebNavigationViewController.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ class GutenbergWebNavigationController: UINavigationController {
3232
super.present(viewControllerToPresent, animated: flag, completion: completion)
3333
}
3434

35-
guard
36-
#available(iOS 13, *),
37-
let menuViewControllerClass = NSClassFromString("UIDocumentMenuViewController"), // Silence deprecation warning.
35+
guard let menuViewControllerClass = NSClassFromString("UIDocumentMenuViewController"), // Silence deprecation warning.
3836
viewControllerToPresent.isKind(of: menuViewControllerClass),
3937
UIDevice.current.userInterfaceIdiom == .phone
4038
else {

WordPress/Classes/ViewRelated/Gutenberg/Views/GutenGhostView.swift

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,7 @@ class GutenGhostView: UIView {
9595
}
9696

9797
private extension UIColor {
98-
static var ghostToolbarBackground: UIColor {
99-
if #available(iOS 13, *) {
100-
return UIColor(light: .clear, dark: UIColor.colorFromHex("2e2e2e"))
101-
}
102-
return .clear
103-
}
98+
static var ghostToolbarBackground: UIColor = UIColor(light: .clear, dark: UIColor.colorFromHex("2e2e2e"))
10499

105100
static var ghostBlockBackground: UIColor {
106101
return UIColor(light: .clear, dark: .systemGray5)

WordPress/Classes/ViewRelated/Post/AuthorFilterViewController.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,7 @@ class AuthorFilterViewController: UITableViewController {
4848
tableView.separatorColor = .clear
4949
tableView.isScrollEnabled = false
5050
tableView.showsVerticalScrollIndicator = false
51-
if #available(iOS 13, *) {
52-
tableView.contentInset = .zero
53-
} else {
54-
tableView.contentInset = UIEdgeInsets(top: -Metrics.topinset, left: 0, bottom: 0, right: 0)
55-
}
51+
tableView.contentInset = .zero
5652
}
5753

5854
required init?(coder aDecoder: NSCoder) {

WordPress/Classes/ViewRelated/Post/PostTagPickerViewController.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ class PostTagPickerViewController: UIViewController {
145145

146146
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
147147
super.traitCollectionDidChange(previousTraitCollection)
148-
if #available(iOS 13, *) {
149-
textViewContainer.layer.borderColor = UIColor.divider.cgColor
150-
}
148+
textViewContainer.layer.borderColor = UIColor.divider.cgColor
151149
}
152150

153151
@objc func doneButtonPressed() {

WordPress/Classes/ViewRelated/Reader/Detail/WebView/ReaderWebView.swift

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,19 +159,15 @@ class ReaderWebView: WKWebView {
159159
/// Maps app colors to CSS colors to be applied in the webview
160160
///
161161
private func cssColors() -> String {
162-
if #available(iOS 13, *) {
163-
return """
164-
@media (prefers-color-scheme: dark) {
165-
\(mappedCSSColors(.dark))
166-
}
167-
168-
@media (prefers-color-scheme: light) {
169-
\(mappedCSSColors(.light))
170-
}
171-
"""
172-
}
162+
return """
163+
@media (prefers-color-scheme: dark) {
164+
\(mappedCSSColors(.dark))
165+
}
173166
174-
return lightCSSColors()
167+
@media (prefers-color-scheme: light) {
168+
\(mappedCSSColors(.light))
169+
}
170+
"""
175171
}
176172

177173
/// If iOS 13, returns light and dark colors

WordPress/Classes/ViewRelated/Reader/Select Interests/ReaderInterestsStyleGuide.swift

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,7 @@ class ReaderInterestsStyleGuide {
3636
}
3737

3838
// MARK: - Next Button
39-
public class var buttonContainerViewBackgroundColor: UIColor {
40-
if #available(iOS 13, *) {
41-
return .tertiarySystemBackground
42-
}
43-
44-
return .white
45-
}
39+
public static var buttonContainerViewBackgroundColor: UIColor = .tertiarySystemBackground
4640

4741
public class func applyNextButtonStyle(button: FancyButton) {
4842
let disabledBackgroundColor: UIColor

0 commit comments

Comments
 (0)