Documentation Archive Developer
Search

MessageUI Changes for Swift

MessageUI

Removed MessageComposeResult.init(_: UInt32)
Removed MessageComposeResult.init(rawValue: UInt32)
Removed MessageComposeResult.rawValue
Removed MFMailComposeErrorCode.init(_: UInt32)
Removed MFMailComposeErrorCode.init(rawValue: UInt32)
Removed MFMailComposeErrorCode.rawValue
Removed MFMailComposeResult.init(_: UInt32)
Removed MFMailComposeResult.init(rawValue: UInt32)
Removed MFMailComposeResult.rawValue
DeclarationProtocolsIntroductionRaw Value Type
From
struct MessageComposeResult : RawRepresentable, Equatable {
    init(_ rawValue: UInt32)
    init(rawValue rawValue: UInt32)
    var rawValue: UInt32
}
Equatable, RawRepresentableiOS 8.1--
To
enum MessageComposeResult : Int {
    case cancelled
    case sent
    case failed
}
--iOS 4.0Int

NameDeclarationIntroduction
FromMessageComposeResultCancelled
var MessageComposeResultCancelled: MessageComposeResult { get }
iOS 8.0
Tocancelled
case cancelled
iOS 10.0

NameDeclarationIntroduction
FromMessageComposeResultFailed
var MessageComposeResultFailed: MessageComposeResult { get }
iOS 8.0
Tofailed
case failed
iOS 10.0

NameDeclarationIntroduction
FromMessageComposeResultSent
var MessageComposeResultSent: MessageComposeResult { get }
iOS 8.0
Tosent
case sent
iOS 10.0

NameDeclarationProtocolsRaw Value Type
FromMFMailComposeError
struct MFMailComposeErrorCode : RawRepresentable, Equatable {
    init(_ rawValue: UInt32)
    init(rawValue rawValue: UInt32)
    var rawValue: UInt32
}
Equatable, RawRepresentable--
ToMFMailComposeError.Code
enum Code : Int {
        typealias _ErrorType = MFMailComposeError
        case saveFailed
        case sendFailed
    }
--Int

NameDeclarationIntroduction
FromMFMailComposeErrorCodeSaveFailed
var MFMailComposeErrorCodeSaveFailed: MFMailComposeErrorCode { get }
iOS 8.0
TosaveFailed
case saveFailed
iOS 10.0

NameDeclarationIntroduction
FromMFMailComposeErrorCodeSendFailed
var MFMailComposeErrorCodeSendFailed: MFMailComposeErrorCode { get }
iOS 8.0
TosendFailed
case sendFailed
iOS 10.0

DeclarationProtocolsIntroductionRaw Value Type
From
struct MFMailComposeResult : RawRepresentable, Equatable {
    init(_ rawValue: UInt32)
    init(rawValue rawValue: UInt32)
    var rawValue: UInt32
}
Equatable, RawRepresentableiOS 8.1--
To
enum MFMailComposeResult : Int {
    case cancelled
    case saved
    case sent
    case failed
}
--iOS 3.0Int

NameDeclarationIntroduction
FromMFMailComposeResultCancelled
var MFMailComposeResultCancelled: MFMailComposeResult { get }
iOS 8.0
Tocancelled
case cancelled
iOS 10.0

NameDeclarationIntroduction
FromMFMailComposeResultFailed
var MFMailComposeResultFailed: MFMailComposeResult { get }
iOS 8.0
Tofailed
case failed
iOS 10.0

NameDeclarationIntroduction
FromMFMailComposeResultSaved
var MFMailComposeResultSaved: MFMailComposeResult { get }
iOS 8.0
Tosaved
case saved
iOS 10.0

NameDeclarationIntroduction
FromMFMailComposeResultSent
var MFMailComposeResultSent: MFMailComposeResult { get }
iOS 8.0
Tosent
case sent
iOS 10.0

Declaration
From
class MFMailComposeViewController : UINavigationController {
    class func canSendMail() -> Bool
    unowned(unsafe) var mailComposeDelegate: MFMailComposeViewControllerDelegate?
    func setSubject(_ subject: String)
    func setToRecipients(_ toRecipients: [String]?)
    func setCcRecipients(_ ccRecipients: [String]?)
    func setBccRecipients(_ bccRecipients: [String]?)
    func setMessageBody(_ body: String, isHTML isHTML: Bool)
    func addAttachmentData(_ attachment: NSData, mimeType mimeType: String, fileName filename: String)
}
To
class MFMailComposeViewController : UINavigationController {
    class func canSendMail() -> Bool
    unowned(unsafe) var mailComposeDelegate: MFMailComposeViewControllerDelegate?
    func setSubject(_ subject: String)
    func setToRecipients(_ toRecipients: [String]?)
    func setCcRecipients(_ ccRecipients: [String]?)
    func setBccRecipients(_ bccRecipients: [String]?)
    func setMessageBody(_ body: String, isHTML isHTML: Bool)
    func addAttachmentData(_ attachment: Data, mimeType mimeType: String, fileName filename: String)
}

Declaration
From
func addAttachmentData(_ attachment: NSData, mimeType mimeType: String, fileName filename: String)
To
func addAttachmentData(_ attachment: Data, mimeType mimeType: String, fileName filename: String)

Declaration
From
protocol MFMailComposeViewControllerDelegate : NSObjectProtocol {
    optional func mailComposeController(_ controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error error: NSError?)
}
To
protocol MFMailComposeViewControllerDelegate : NSObjectProtocol {
    optional func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error error: Error?)
}

Declaration
From
optional func mailComposeController(_ controller: MFMailComposeViewController, didFinishWithResult result: MFMailComposeResult, error error: NSError?)
To
optional func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error error: Error?)

Declaration
From
class MFMessageComposeViewController : UINavigationController {
    class func canSendText() -> Bool
    class func canSendSubject() -> Bool
    class func canSendAttachments() -> Bool
    class func isSupportedAttachmentUTI(_ uti: String) -> Bool
    unowned(unsafe) var messageComposeDelegate: MFMessageComposeViewControllerDelegate?
    func disableUserAttachments()
    var recipients: [String]?
    var body: String?
    var subject: String?
    var attachments: [[NSObject : AnyObject]]? { get }
    func addAttachmentURL(_ attachmentURL: NSURL, withAlternateFilename alternateFilename: String?) -> Bool
    func addAttachmentData(_ attachmentData: NSData, typeIdentifier uti: String, filename filename: String) -> Bool
}
To
class MFMessageComposeViewController : UINavigationController {
    class func canSendText() -> Bool
    class func canSendSubject() -> Bool
    class func canSendAttachments() -> Bool
    class func isSupportedAttachmentUTI(_ uti: String) -> Bool
    unowned(unsafe) var messageComposeDelegate: MFMessageComposeViewControllerDelegate?
    func disableUserAttachments()
    var recipients: [String]?
    var body: String?
    var subject: String?
    var attachments: [[AnyHashable : Any]]? { get }
    @NSCopying var message: MSMessage?
    func addAttachmentURL(_ attachmentURL: URL, withAlternateFilename alternateFilename: String?) -> Bool
    func addAttachmentData(_ attachmentData: Data, typeIdentifier uti: String, filename filename: String) -> Bool
}

Declaration
From
func addAttachmentData(_ attachmentData: NSData, typeIdentifier uti: String, filename filename: String) -> Bool
To
func addAttachmentData(_ attachmentData: Data, typeIdentifier uti: String, filename filename: String) -> Bool

Declaration
From
func addAttachmentURL(_ attachmentURL: NSURL, withAlternateFilename alternateFilename: String?) -> Bool
To
func addAttachmentURL(_ attachmentURL: URL, withAlternateFilename alternateFilename: String?) -> Bool

Declaration
From
var attachments: [[NSObject : AnyObject]]? { get }
To
var attachments: [[AnyHashable : Any]]? { get }

Declaration
From
protocol MFMessageComposeViewControllerDelegate : NSObjectProtocol {
    func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWithResult result: MessageComposeResult)
}
To
protocol MFMessageComposeViewControllerDelegate : NSObjectProtocol {
    func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult)
}

Declaration
From
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWithResult result: MessageComposeResult)
To
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult)

NameDeclaration
FromMFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification
let MFMessageComposeViewControllerTextMessageAvailabilityDidChangeNotification: String
ToMFMessageComposeViewControllerTextMessageAvailabilityDidChange
static let MFMessageComposeViewControllerTextMessageAvailabilityDidChange: NSNotification.Name