Search code examples
iosswiftmfmessagecomposeviewcontroller

Add MFMessageComposeViewControllerTextMessageAvailabilityDidChange notification


I want to set MFMessageComposeViewControllerTextMessageAvailabilityDidChange notification to observer. I am new to swift so, i am not clear about how to do that. Please help me.


Solution

  • Swift 3.0

     let notificationCenter = NotificationCenter.default // Note that default is now a property, not a method call
     notificationCenter.addObserver(forName: Notification.Name(rawValue: MFMessageComposeViewControllerTextMessageAvailabilityDidChange),object: nil, queue: nil,using: catchNotification)
    
     //handle the notification fired method
     func catchNotification(notification: Notification) -> Void {
    
     }