Skip to content

Commit a6df43f

Browse files
committed
Rename constants for readability
1 parent 3fb678b commit a6df43f

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

WooCommerce/Classes/Extensions/UIButton+Helpers.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ extension UIButton {
1010
func applyPrimaryButtonStyle() {
1111
var configuration = UIButton.Configuration.filled()
1212
configuration.contentInsets = .init(
13-
top: Style.defaultVerticalInsets,
14-
leading: Style.defaultHorizontalInsets,
15-
bottom: Style.defaultVerticalInsets,
16-
trailing: Style.defaultHorizontalInsets
13+
top: Style.verticalInset,
14+
leading: Style.horizontalInset,
15+
bottom: Style.verticalInset,
16+
trailing: Style.horizontalInset
1717
)
1818
layer.borderColor = UIColor.primaryButtonBorder.cgColor
1919
layer.borderWidth = Style.defaultBorderWidth
@@ -47,10 +47,10 @@ extension UIButton {
4747
func applySecondaryButtonStyle() {
4848
var configuration = UIButton.Configuration.filled()
4949
configuration.contentInsets = .init(
50-
top: Style.defaultVerticalInsets,
51-
leading: Style.defaultHorizontalInsets,
52-
bottom: Style.defaultVerticalInsets,
53-
trailing: Style.defaultHorizontalInsets
50+
top: Style.verticalInset,
51+
leading: Style.horizontalInset,
52+
bottom: Style.verticalInset,
53+
trailing: Style.horizontalInset
5454
)
5555
backgroundColor = .secondaryButtonBackground
5656
layer.borderColor = UIColor.secondaryButtonBorder.cgColor
@@ -85,10 +85,10 @@ extension UIButton {
8585
func applyLinkButtonStyle(enableMultipleLines: Bool = false) {
8686
var configuration = UIButton.Configuration.plain()
8787
configuration.contentInsets = .init(
88-
top: Style.defaultVerticalInsets,
89-
leading: Style.defaultHorizontalInsets,
90-
bottom: Style.defaultVerticalInsets,
91-
trailing: Style.defaultHorizontalInsets
88+
top: Style.verticalInset,
89+
leading: Style.horizontalInset,
90+
bottom: Style.verticalInset,
91+
trailing: Style.horizontalInset
9292
)
9393
backgroundColor = .clear
9494
tintColor = .accent
@@ -115,10 +115,10 @@ extension UIButton {
115115
func applyPaymentsModalCancelButtonStyle() {
116116
var configuration = UIButton.Configuration.plain()
117117
configuration.contentInsets = .init(
118-
top: Style.defaultVerticalInsets,
119-
leading: Style.defaultHorizontalInsets,
120-
bottom: Style.defaultVerticalInsets,
121-
trailing: Style.defaultHorizontalInsets
118+
top: Style.verticalInset,
119+
leading: Style.horizontalInset,
120+
bottom: Style.verticalInset,
121+
trailing: Style.horizontalInset
122122
)
123123
backgroundColor = .tertiarySystemBackground
124124
layer.borderColor = UIColor.secondaryButtonBorder.cgColor
@@ -193,7 +193,7 @@ private extension UIButton {
193193
struct Style {
194194
static let defaultCornerRadius = CGFloat(8.0)
195195
static let defaultBorderWidth = CGFloat(1.0)
196-
static let defaultVerticalInsets = CGFloat(12)
197-
static let defaultHorizontalInsets = CGFloat(22)
196+
static let verticalInset = CGFloat(12)
197+
static let horizontalInset = CGFloat(22)
198198
}
199199
}

WooCommerce/Classes/ViewRelated/ReusableViews/VerticalButton.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ class VerticalButton: UIButton {
4444
var configuration = UIButton.Configuration.filled()
4545
configuration.contentInsets = .init(
4646
top: .zero,
47-
leading: Settings.horizontalEdgeInsets,
47+
leading: Settings.inset,
4848
bottom: .zero,
49-
trailing: Settings.horizontalEdgeInsets
49+
trailing: Settings.inset
5050
)
5151
layer.cornerRadius = Settings.cornerRadius
5252
titleLabel?.font = UIFont.footnote
@@ -60,7 +60,7 @@ private extension VerticalButton {
6060

6161
enum Settings {
6262
static let cornerRadius = CGFloat(10)
63-
static let horizontalEdgeInsets = CGFloat(5)
63+
static let inset = CGFloat(5)
6464
static let labelPaddingTop = CGFloat(2)
6565
}
6666
}

WooCommerce/Classes/ViewRelated/Survey/SurveySubmittedViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ private extension SurveySubmittedViewController {
9393

9494
contactUsButton.applyLinkButtonStyle()
9595
contactUsButton.titleLabel?.applyCalloutStyle()
96-
var contactUsconfiguration = UIButton.Configuration.plain()
97-
contactUsconfiguration.contentInsets = .init(.zero)
98-
contactUsButton.configuration = contactUsconfiguration
96+
var contactUsConfiguration = UIButton.Configuration.plain()
97+
contactUsConfiguration.contentInsets = .init(.zero)
98+
contactUsButton.configuration = contactUsConfiguration
9999
}
100100

101101
/// Apply the correspondent localized texts to each component

0 commit comments

Comments
 (0)