Created
April 5, 2019 15:18
-
-
Save sanketfirodiya/ba666c1085218b01765311409a296618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension ViewController: MFMessageComposeViewControllerDelegate { | |
func showMessageComposeViewController() { | |
guard MFMessageComposeViewController.canSendText() else { | |
print("SMS services are not available") | |
return | |
} | |
let messageComposeViewController = MFMessageComposeViewController() | |
messageComposeViewController.messageComposeDelegate = self | |
messageComposeViewController.body = "Your text here" | |
present(messageComposeViewController, animated: true) | |
} | |
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) { | |
controller.dismiss(animated: true, completion: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment