I'm trying to implement the PKPaymentButton in SwiftUI, but I cannot figure out how to create a wrapper for the PKPaymentButton. My code is below:
struct ApplePayButton: UIViewRepresentable {
func makeUIViewController(context: Context) -> PKPaymentButton {
return PKPaymentButton.init()
}
func updateUIView(_ uiView: ApplePayButton.UIViewType, context: UIViewRepresentableContext<ApplePayButton>) {
//
}
}
I am getting the following errors:
- Reference to invalid associated type 'UIViewType' of type 'ApplePayButton'
- Type 'ApplePayButton' does not conform to protocol 'UIViewRepresentable'
Has anyone been able to do this, or does anyone have a better way of implementing Apple Pay in SwiftUI?