Hi, this is kind of a myth right now since the documentation is like a ghost. How can I integrate Apple Pay on my SwiftUI app? Is there any guide/doc or useful Simple code to review?
Thanks
Thanks
Right, the sample code for this is lacking, so I would open a bug report for examples of how this done. The thing to remember about Apple Pay is that there are Human Interface Guidelines on how buttons are displayed. So in SwiftUI when creating these buttons, just keep that in mind.
Because code snippets like the one I put together above uses an empty label: Text(""), which, is not great, however just adding a text label that says Apple Pay on it also conflicts with the Human Interface Guideline. So please mention things like things like this in the bug report you create and follow up with the feedback id so I can copy myself on it.
Matt Eaton
DTS Engineering, CoreOS
Code Block swift struct ApplePayButton: UIViewRepresentable { func updateUIView(_ uiView: PKPaymentButton, context: Context) { } func makeUIView(context: Context) -> PKPaymentButton { return PKPaymentButton(paymentButtonType: .plain, paymentButtonStyle: .black) } } struct ApplePayButtonStyle: ButtonStyle { func makeBody(configuration: Self.Configuration) -> some View { return ApplePayButton() } } Button( action: { self.setupPKPaymentRequest() }, label: { Text("")} ) .frame(width: 212, height: 38, alignment: .center) .buttonStyle(ApplePayButtonStyle()
Because code snippets like the one I put together above uses an empty label: Text(""), which, is not great, however just adding a text label that says Apple Pay on it also conflicts with the Human Interface Guideline. So please mention things like things like this in the bug report you create and follow up with the feedback id so I can copy myself on it.
Matt Eaton
DTS Engineering, CoreOS