O'Reilly logo

Learning Swift by Tim Nugent, Jon Manning, Paris Buttfield-Addison

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

Note

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required