Documentation Archive Developer
Search

MessageUI Changes for Swift

MessageUI

Removed MessageComposeResult.value
Removed MFMailComposeErrorCode.value
Removed MFMailComposeResult.value
Added MessageComposeResult.init(rawValue: UInt32)
Added MessageComposeResult.rawValue
Added MFMailComposeErrorCode.init(rawValue: UInt32)
Added MFMailComposeErrorCode.rawValue
Added MFMailComposeResult.init(rawValue: UInt32)
Added MFMailComposeResult.rawValue
DeclarationProtocols
From
struct MessageComposeResult {
    init(_ value: UInt32)
    var value: UInt32
}
--
To
struct MessageComposeResult : RawRepresentable {
    init(_ rawValue: UInt32)
    init(rawValue rawValue: UInt32)
    var rawValue: UInt32
}
RawRepresentable

DeclarationProtocols
From
struct MFMailComposeErrorCode {
    init(_ value: UInt32)
    var value: UInt32
}
--
To
struct MFMailComposeErrorCode : RawRepresentable {
    init(_ rawValue: UInt32)
    init(rawValue rawValue: UInt32)
    var rawValue: UInt32
}
RawRepresentable

DeclarationProtocols
From
struct MFMailComposeResult {
    init(_ value: UInt32)
    var value: UInt32
}
--
To
struct MFMailComposeResult : RawRepresentable {
    init(_ rawValue: UInt32)
    init(rawValue rawValue: UInt32)
    var rawValue: UInt32
}
RawRepresentable

Declaration
From
class MFMailComposeViewController : UINavigationController {
    class func canSendMail() -> Bool
    unowned(unsafe) var mailComposeDelegate: MFMailComposeViewControllerDelegate!
    func setSubject(_ subject: String!)
    func setToRecipients(_ toRecipients: [AnyObject]!)
    func setCcRecipients(_ ccRecipients: [AnyObject]!)
    func setBccRecipients(_ bccRecipients: [AnyObject]!)
    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: NSData, mimeType mimeType: String, fileName filename: String)
}

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

Declaration
From
unowned(unsafe) var mailComposeDelegate: MFMailComposeViewControllerDelegate!
To
unowned(unsafe) var mailComposeDelegate: MFMailComposeViewControllerDelegate?

Declaration
From
func setBccRecipients(_ bccRecipients: [AnyObject]!)
To
func setBccRecipients(_ bccRecipients: [String]?)

Declaration
From
func setCcRecipients(_ ccRecipients: [AnyObject]!)
To
func setCcRecipients(_ ccRecipients: [String]?)

Declaration
From
func setMessageBody(_ body: String!, isHTML isHTML: Bool)
To
func setMessageBody(_ body: String, isHTML isHTML: Bool)

Declaration
From
func setSubject(_ subject: String!)
To
func setSubject(_ subject: String)

Declaration
From
func setToRecipients(_ toRecipients: [AnyObject]!)
To
func setToRecipients(_ toRecipients: [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, didFinishWithResult result: MFMailComposeResult, error error: NSError?)
}

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

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: [AnyObject]!
    var body: String!
    var subject: String!
    var attachments: [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: [[NSObject : AnyObject]]? { get }
    func addAttachmentURL(_ attachmentURL: NSURL, withAlternateFilename alternateFilename: String?) -> Bool
    func addAttachmentData(_ attachmentData: NSData, typeIdentifier uti: String, filename filename: String) -> Bool
}

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

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

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

Declaration
From
var body: String!
To
var body: String?

Declaration
From
class func isSupportedAttachmentUTI(_ uti: String!) -> Bool
To
class func isSupportedAttachmentUTI(_ uti: String) -> Bool

Declaration
From
unowned(unsafe) var messageComposeDelegate: MFMessageComposeViewControllerDelegate!
To
unowned(unsafe) var messageComposeDelegate: MFMessageComposeViewControllerDelegate?

Declaration
From
var recipients: [AnyObject]!
To
var recipients: [String]?

Declaration
From
var subject: String!
To
var subject: String?

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

DeclarationIntroduction
From
func messageComposeViewController(_ controller: MFMessageComposeViewController!, didFinishWithResult result: MessageComposeResult)
iOS 8.0
To
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWithResult result: MessageComposeResult)
iOS 4.0