在 Swift 中,我会这样做来显示一个预先组合的消息。
在SwiftUI中,这会抛出错误。
并且
let composeVC = MFMessageComposeViewController()
composeVC.messageComposeDelegate = self
composeVC.recipients = ["9999999999"]
composeVC.body = "Text Message"
if MFMessageComposeViewController.canSendText() {
self.present(composeVC, animated: true, completion: nil)
}
在SwiftUI中,这会抛出错误。
Cannot assign value of type 'ContentView' to type 'MFMessageComposeViewControllerDelegate?'
并且
Value of type 'ContentView' has no member 'present'