This is sample code:
import UIKit
import MessageUI
class ViewController: UIViewController, MFMailComposeViewControllerDelegate {
@IBAction func showEmail(s
In swift 3.0 -> Syntax Change
func mailComposeController(controller: MFMailComposeViewController,
didFinishWithResult result: MFMailComposeResult, error: NSError?) {
switch result.rawValue {
case MFMailComposeResult.Cancelled.rawValue:
print("Mail cancelled")
case MFMailComposeResult.Saved.rawValue:
print("Mail saved")
case MFMailComposeResult.Sent.rawValue:
print("Mail sent")
case MFMailComposeResult.Failed.rawValue:
print("Mail sent failure: %@", [error!.localizedDescription])
default:
break
}
// Dismiss the mail compose view controller.
controller.dismissViewControllerAnimated(true, completion: nil)
}