Chapter 6
Working with Email and Attachments

The MessageUI framework has made it really easy to send an email from your apps. You can easily use the built-in APIs to integrate an email composer in your app. In this short chapter, we'll show you how to send emails and work with email attachments by creating a simple app.

Since the primary focus is to demonstrate the email feature of the MessageUI framework, we will keep the demo app very simple. The app simply displays a list of files in a plain table view. We'll populate the table with various types of files, including images in both PNG and JPEG formats, a Microsoft Word document, a Powerpoint file, a PDF document, and an HTML file. Whenever users tap on any of the files, the app automatically creates an email with the selected file as an attachment.

Starting with the Xcode Project Template

To save you from creating the Xcode project from scratch, you can download the project template from http://www.appcoda.com/resources/swift55/EmailAttachmentStarter.zip to begin the development. The project template comes with:

After downloading and extracting the zipped file, you can compile and run the project. The demo app should display a list of files on the main screen. Now, we'll continue to implement the email feature.

Figure 6.1. The demo app showing a list of attachments
Figure 6.1. The demo app showing a list of attachments

To continue reading and access the full version of the book, please get the full copy here. You will also be able to access the full source code of the project.

results matching ""

    No results matching ""