Chapter 14. Multimedia, Contacts, Location, and Notifications

In this chapter, we’ll improve the iOS app by adding more capabilities to the attachment system, as well as notifications. We’ll add support for location, audio, video, and address book contacts, as well as the ability to set local notifications that can remind users of their notes.

In Notes, each attachment is represented by a file that’s added to the document’s Attachments directory, and is managed by a view controller. Because of the architecture of the application, all we need to do to add support for different attachment types is to create a new view controller for it and add code to a couple of existing methods in DocumentListViewController to make them open the necessary view controller for each attachment type.

Let’s get started by building support for adding attachments containing a geographic location!

Location Attachments

iOS devices have a whole bunch of useful sensors on them, and one of the most useful is the GPS. When it comes time to determine the location of the device, though, iOS doesn’t rely solely on the GPS! It has a whole collection of tricks up its sleeve that allow it to more accurately and rapidly pinpoint a location.


The Core Location framework provides a whole suite of location-based features for you to use—everything from a quick and efficient way to get the current location, to monitoring entry and exit from specific regions, looking for Bluetooth beacons, to significant-change location ...

Get Learning Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.