I've been trying to send email from a SwiftUI view (see code further below).However, I'm running into the following issues:Non-class type 'SettingsView' cannot conform to class protocol 'MFMailComposeViewControllerDelegate'But if make SettingsView a class, then I get a ton of errors.Has anyone found a good way to solve this issue?import SwiftUIimport MessageUIstruct SettingsView : View, MFMailComposeViewControllerDelegate { var body: some View { Button(action: emailSupport) { Text("Email support") } } func emailSupport() { if MFMailComposeViewController.canSendMail() { let mail = MFMailComposeViewController() mail.mailComposeDelegate = self mail.setSubject("Some subject") mail.setToRecipients(["someemail@example.com"]) mail.setMessageBody("Some body", isHTML:false) present(mail, animated: true) } else { // show failure alert } } func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) { controller.dismiss(animated: true) }}
Post
Replies
Boosts
Views
Activity
Anyone seeing this as well? This simple content will display a blank screen in landscape mode.```struct ContentView : View { var body: some View { NavigationView { Text("Hello World") } }}```