Skip to content

Commit

Permalink
Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexaubry committed Aug 7, 2020
1 parent 4074ddf commit b0d77d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions App/Screens/Card/Views/MetroCardActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct MetroCardActionButton: View {
}
}

let title: LocalizedStringKey
let title: Text
let buttonText: Text
let action: () -> Void

Expand All @@ -26,12 +26,12 @@ struct MetroCardActionButton: View {
/// - parameter value: The localized value that is currently associated with the action.
/// - parameter actionLabel: The label to use in the action button if there is no value.
/// - parameter action: The action to execute when the button is pressed.
init(title: LocalizedStringKey, value: String?, actionLabel: ActionLabel, action: @escaping () -> Void) {
init(title: Text, value: Text?, actionLabel: ActionLabel, action: @escaping () -> Void) {
self.title = title
self.action = action

if let value = value {
buttonText = Text(verbatim: value)
buttonText = value
} else {
buttonText = actionLabel.text
}
Expand All @@ -41,7 +41,7 @@ struct MetroCardActionButton: View {

var body: some View {
VStack(spacing: 8) {
Text(verbatim: title)
title
.font(.caption)
.fontWeight(.medium)
.lineLimit(1)
Expand All @@ -55,7 +55,7 @@ struct MetroCardActionButton: View {
action: actionButtonTapped
)
}.accessibilityElement(children: .ignore)
.accessibility(label: Text(verbatim: title))
.accessibility(label: title)
.accessibility(value: buttonText)
.accessibility(addTraits: .isButton)
}
Expand Down
14 changes: 7 additions & 7 deletions App/Screens/Card/Views/MetroCardActionGrid.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@ struct MetroCardActionGrid: View {
VStack(alignment: .leading, spacing: 16) {
FlexibleStack(hStackAlignment: .top, vStackAlignment: .leading) {
MetroCardActionButton(
title: "BALANCE",
title: Text("BALANCE"),
value: nil,
actionLabel: .update,
action: updateBalanceButtonTapped
).accessibility(identifier: "balance-button")

MetroCardActionButton(
title: "FARE",
value: viewModel.data.formattedFare,
title: Text("FARE"),
value: Text(verbatim: viewModel.data.formattedFare),
actionLabel: .update,
action: updateFareButtonTapped
).accessibility(identifier: "fare-button")
}

FlexibleStack(hStackAlignment: .top, vStackAlignment: .leading) {
MetroCardActionButton(
title: "EXPIRATION",
value: viewModel.data.formattedExpirationDate,
title: Text("EXPIRATION"),
value: viewModel.data.formattedExpirationDate.map(Text.init(verbatim:)),
actionLabel: .add,
action: updateExpirationDateButtonTapped
).accessibility(identifier: "expiration-button")

MetroCardActionButton(
title: "CARD NUMBER",
value: viewModel.data.formattedSerialNumber,
title: Text("CARD NUMBER"),
value: viewModel.data.formattedSerialNumber.map(Text.init(verbatim:)),
actionLabel: .add,
action: updateSerialNumberButtonTapped
).accessibility(identifier: "card-number-button")
Expand Down

0 comments on commit b0d77d2

Please sign in to comment.