Home / Companies / Twilio / Blog / Post Details
Content Deep Dive

Sending text messages from your iOS app in Swift using MFMessageComposeViewController

Blog post from Twilio

Post Details
Company
Date Published
Author
Sam Agnew
Word Count
592
Company Posts That Month
16
Language
English
Hacker News Points
-
Summary

The iOS app can display a pre-composed message for the user to send using MFMessageComposeViewController. The user's phone number is not required, but if programmatically sending an SMS from a different phone number is desired, Swift and Twilio can be used. To get started, Xcode 9 and Swift 4 are needed, and a new project should be created with the "Single View App" option. A ViewController class must conform to MFMessageComposeViewControllerDelegate protocol and add a stub method. A function called displayMessageInterface is added to present the message composition interface with a pre-populated body and recipient number. The function is then wired up to a button in Main.storyboard, allowing it to be executed when pressed.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
Real-time 1 305 93 37 +11%