I’m utilizing this code to ship a e-mail message. However I do not see MFMailComposeViewController
when will I name it.
import MessageUI
class Mail: UIViewController, MFMailComposeViewControllerDelegate {
override func viewDidLoad() {
tremendous.viewDidLoad()
}
func ship(title: String, deal with: [String], message: String, errorTitle: String, errorMessage: String) {
if MFMailComposeViewController.canSendMail() {
let mail = MFMailComposeViewController()
mail.mailComposeDelegate = self
mail.setSubject(title)
mail.setToRecipients(deal with)
mail.setMessageBody(message, isHTML: false)
current(mail, animated: true, completion: nil)
} else {
let alert = UIAlertController(title: errorTitle, message: errorMessage, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", type: .default, handler: nil))
self.current(alert, animated: true, completion: nil)
}
}
func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith outcome: MFMailComposeResult, error: Error?) {
controller.dismiss(animated: true, completion: nil)
}
}
Nothing occurs once I name the contactWithDeveloper()
operate:
func contactWithDeveloper() {
Mail().ship(title: "title", deal with: ["[email protected]"], message: "message", errorTitle: "errorTitle", errorMessage: "errorMessage")
}
However the Mail
class is named. Easy methods to repair this?