Skip to content

Commit ed74281

Browse files
authored
Remove redundant #available and @available for iOS 13 (#19699)
2 parents bff014b + 9f440b1 commit ed74281

File tree

16 files changed

+28
-111
lines changed

16 files changed

+28
-111
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 let 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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ class TimeSelectionView: UIView {
77

88
private lazy var timePicker: UIDatePicker = {
99
let datePicker = UIDatePicker()
10-
11-
if #available(iOS 13.4, *) {
12-
datePicker.preferredDatePickerStyle = .wheels
13-
}
14-
10+
datePicker.preferredDatePickerStyle = .wheels
1511
datePicker.datePickerMode = .time
1612
datePicker.translatesAutoresizingMaskIntoConstraints = false
1713
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: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,11 @@ class GutenGhostView: UIView {
9393
}
9494

9595
private extension UIColor {
96-
static var ghostToolbarBackground: UIColor {
97-
if #available(iOS 13, *) {
98-
return UIColor(light: .clear, dark: UIColor.colorFromHex("2e2e2e"))
99-
}
100-
return .clear
101-
}
96+
static let ghostToolbarBackground = UIColor(light: .clear, dark: UIColor.colorFromHex("2e2e2e"))
10297

103-
static var ghostBlockBackground: UIColor {
104-
return UIColor(light: .clear, dark: .systemGray5)
105-
}
98+
static let ghostBlockBackground = UIColor(light: .clear, dark: .systemGray5)
10699

107-
static var beatEndColor: UIColor {
108-
return UIColor(light: .systemGray6, dark: .clear)
109-
}
100+
static let beatEndColor = UIColor(light: .systemGray6, dark: .clear)
110101

111-
static var background: UIColor {
112-
return .systemBackground
113-
}
102+
static let background = UIColor.systemBackground
114103
}

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 & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -159,24 +159,17 @@ 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

177-
/// If iOS 13, returns light and dark colors
178-
///
179-
@available(iOS 13, *)
180173
private func mappedCSSColors(_ style: UIUserInterfaceStyle) -> String {
181174
let trait = UITraitCollection(userInterfaceStyle: style)
182175
UIColor(light: .muriel(color: .gray, .shade40),
@@ -196,21 +189,4 @@ class ReaderWebView: WKWebView {
196189
}
197190
"""
198191
}
199-
200-
/// If iOS 12 or below, returns only light colors
201-
///
202-
private func lightCSSColors() -> String {
203-
return """
204-
:root {
205-
--color-text: #\(UIColor.text.hexString() ?? "");
206-
--color-neutral-0: #\(UIColor.listForegroundUnread.hexString() ?? "");
207-
--color-neutral-10: #\(UIColor(color: .muriel(color: .gray, .shade10)).hexString() ?? "");
208-
--color-neutral-40: #\(UIColor(color: .muriel(color: .gray, .shade40)).hexString() ?? "");
209-
--color-neutral-50: #\(UIColor.textSubtle.hexString() ?? "");
210-
--color-neutral-70: #\(UIColor.text.hexString() ?? "");
211-
--main-link-color: #\(UIColor.primary.hexString() ?? "");
212-
--main-link-active-color: #\(UIColor.primaryDark.hexString() ?? "");
213-
}
214-
"""
215-
}
216192
}

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 let buttonContainerViewBackgroundColor: UIColor = .tertiarySystemBackground
4640

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

0 commit comments

Comments
 (0)