Skip to content

Commit cf6e4fa

Browse files
Accelerated Checkouts: rename wallet enum cases to camelCase convention (#343)
refactor: rename wallet enum cases to camelCase convention - Rename Wallet.applepay to Wallet.applePay - Rename Wallet.shoppay to Wallet.shopPay - Update withWallets() modifier to wallets() for consistency - Update all references and localization keys
1 parent deabed2 commit cf6e4fa

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

Samples/ShopifyAcceleratedCheckoutsApp/ShopifyAcceleratedCheckoutsApp/Views/Components/ButtonSet.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct ButtonSet: View {
7979
quantity: firstVariantQuantity
8080
)
8181
.cornerRadius(24)
82-
.withWallets([.applepay, .shoppay])
82+
.wallets([.applePay, .shopPay])
8383
.onComplete { event in
8484
print("✅ Variant checkout completed")
8585
print(" Order ID: \(event.orderDetails.id)")

Sources/ShopifyAcceleratedCheckouts/Localizable.xcstrings

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@
189189
}
190190
}
191191
},
192-
"errors.applepay.unsupported" : {
192+
"errors.applePay.unsupported" : {
193193
"extractionState" : "manual",
194194
"localizations" : {
195195
"en" : {

Sources/ShopifyAcceleratedCheckouts/Wallets/AcceleratedCheckoutButtons.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ import SwiftUI
2828
/// Renders a Checkout buttons for a cart or product variant
2929
///
3030
/// Note:
31-
/// - The `withWallets` modifier can be used to limit the buttons rendered
32-
/// - The order of the buttons is the same as the order of the `withWallets` modifier
33-
/// - omission of the `withWallets` modifier will render all buttons
31+
/// - The `wallets` modifier can be used to limit the buttons rendered
32+
/// - The order of the buttons is the same as the order of the `wallets` modifier
33+
/// - omission of the `wallets` modifier will render all buttons
3434
@available(iOS 17.0, *)
3535
public struct AcceleratedCheckoutButtons: View {
3636
@Environment(ShopifyAcceleratedCheckouts.Configuration.self)
3737
private var configuration
3838

3939
let identifier: CheckoutIdentifier
40-
var wallets: [Wallet] = [.shoppay, .applepay]
40+
var wallets: [Wallet] = [.shopPay, .applePay]
4141
var eventHandlers: EventHandlers = .init()
4242
var cornerRadius: CGFloat?
4343

@@ -67,13 +67,13 @@ public struct AcceleratedCheckoutButtons: View {
6767
VStack {
6868
ForEach(wallets, id: \.self) {
6969
switch $0 {
70-
case .applepay:
70+
case .applePay:
7171
ApplePayButton(
7272
identifier: identifier,
7373
eventHandlers: eventHandlers,
7474
cornerRadius: cornerRadius
7575
)
76-
case .shoppay:
76+
case .shopPay:
7777
ShopPayButton(
7878
identifier: identifier,
7979
eventHandlers: eventHandlers,
@@ -106,8 +106,8 @@ public struct AcceleratedCheckoutButtons: View {
106106
@available(iOS 17.0, *)
107107
extension AcceleratedCheckoutButtons {
108108
/// Modifies the wallet options supported
109-
/// Defaults: [.applepay]
110-
public func withWallets(_ wallets: [Wallet]) -> AcceleratedCheckoutButtons {
109+
/// Defaults: [.applePay]
110+
public func wallets(_ wallets: [Wallet]) -> AcceleratedCheckoutButtons {
111111
var newView = self
112112
newView.wallets = wallets
113113
return newView

Sources/ShopifyAcceleratedCheckouts/Wallets/ApplePay/ApplePayButton.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ struct Internal_ApplePayButton: View {
137137
Task { await controller.startPayment() }
138138
},
139139
fallback: {
140-
// content == nil ? Text("errors.applepay.unsupported") : content
141-
Text("errors.applepay.unsupported".localizedString)
140+
// content == nil ? Text("errors.applePay.unsupported") : content
141+
Text("errors.applePay.unsupported".localizedString)
142142
}
143143
)
144144
.walletButtonStyle(cornerRadius: cornerRadius)

Sources/ShopifyAcceleratedCheckouts/Wallets/Wallet.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
import ShopifyCheckoutSheetKit
2525
import SwiftUI
2626

27-
/// Possible Wallets `AcceleratedCheckouts` can render via the `.withWallets` modifier.
27+
/// Possible Wallets `AcceleratedCheckouts` can render via the `.wallets` modifier.
2828
public enum Wallet {
29-
case applepay
30-
case shoppay
29+
case applePay
30+
case shopPay
3131
}
3232

3333
/// Event handlers for wallet buttons

Tests/ShopifyAcceleratedCheckoutsTests/Wallets/ApplePay/ApplePayIntegrationTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ final class ApplePayIntegrationTests: XCTestCase {
8282
await MainActor.run {
8383
// Create a hosting controller to test SwiftUI integration
8484
let view = AcceleratedCheckoutButtons(cartID: "gid://Shopify/Cart/test-cart")
85-
.withWallets([.applepay])
85+
.wallets([.applePay])
8686
.onComplete { _ in
8787
// Callback exists but won't be called during view creation
8888
}
@@ -112,7 +112,7 @@ final class ApplePayIntegrationTests: XCTestCase {
112112
await MainActor.run {
113113
// Create a hosting controller to test SwiftUI integration with all callbacks
114114
let view = AcceleratedCheckoutButtons(cartID: "gid://Shopify/Cart/test-cart")
115-
.withWallets([.applepay])
115+
.wallets([.applePay])
116116
.onComplete { _ in
117117
completeExpectation.fulfill()
118118
}

0 commit comments

Comments
 (0)