我正在尝试在SwiftUI中实现PKPaymentButton,但是我不知道如何为PKPaymentButton创建包装器。我的代码如下:
struct ApplePayButton: UIViewRepresentable {
func makeUIViewController(context: Context) -> PKPaymentButton {
return PKPaymentButton.init()
}
func updateUIView(_ uiView: ApplePayButton.UIViewType, context: UIViewRepresentableContext<ApplePayButton>) {
//
}
}
我遇到以下错误:
有人能做到这一点,还是有人能更好地在SwiftUI中实现Apple Pay?
声明应类似于以下内容:
import SwiftUI
import UIKit
import PassKit
struct ApplePayButton: UIViewRepresentable {
func makeUIView(context: Context) -> PKPaymentButton {
return PKPaymentButton()
}
func updateUIView(_ uiView: PKPaymentButton,
context: UIViewRepresentableContext<ApplePayButton>) {
//
}
}