iOS 10 SDK Development
Creating iPhone and iPad Apps with Swift
by Chris Adamson, with Janie Clayton
Version: P1.0 (March 2017)
Copyright 2017 The Pragmatic Programmers, LLC. This book is licensed to the individual who purchased it. We don't copy-protect it because that would limit your ability to use it for your own purposes. Please don't break this trustyou can use this across all of your devices but please do not share this copy with other members of your team, with friends, or via file sharing services. Thanks.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.
About the Pragmatic Bookshelf
The Pragmatic Bookshelf is an agile publishing company. Were here because we want to improve the lives of developers. We do this by creating timely, practical titles, written by programmers for programmers.
Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.
Our ebooks do not contain any Digital Restrictions Management, and have always been DRM-free. We pioneered the beta book concept, where you can purchase and read a book while its still being written, and provide feedback to the author to help make a better book for everyone. Free resources for all purchasers include source code downloads (if applicable), errata and discussion forums, all available on the book's home page at pragprog.com. Were here to make your life easier.
New Book Announcements
Want to keep up on our latest titles and announcements, and occasional special offers? Just create an account on pragprog.com (an email address and a password is all it takes) and select the checkbox to receive newsletters. You can also follow us on twitter as @pragprog.
About Ebook Formats
If you buy directly from pragprog.com, you get ebooks in all available formats for one price. You can synch your ebooks amongst all your devices (including iPhone/iPad, Android, laptops, etc.) via Dropbox. You get free updates for the life of the edition. And, of course, you can always come back and re-download your books when needed. Ebooks bought from the Amazon Kindle store are subject to Amazon's polices. Limitations in Amazon's file format may cause ebooks to display differently on different devices. For more information, please see our FAQ at pragprog.com/frequently-asked-questions/ebooks. To learn more about this book and access the free resources, go to https://pragprog.com/book/adios4, the book's homepage.
Thanks for your continued support,
Andy Hunt
The Pragmatic Programmers
The team that produced this book includes: Andy Hunt (Publisher) Janet Furlow (VP of Operations) Susannah Davidson Pfalzer (Executive Editor) Rebecca Gulick (Development Editor) Potomac Indexing, LLC (Indexing) Nicole Abramowitz (Copy Editor) Gilson Graphics (Layout)
For customer support, please contact .
For international rights, please contact .
Table of Contents
Copyright 2017, The Pragmatic Bookshelf.
Acknowledgements
Ten versions of iOS (ne iPhone OS), and weve now managed to get Prags books out for half of them: 3, 6, 8, 9, and 10more than half, if you recall there was no App Store or public SDK for version 1. Now that these releases have become an annual thing, we might finally be getting the hang of this.
My thanks for the latest edition start as always with Pragmatic Programmers, who have an efficient, comfortable workflow that gets out of authors way and lets us write. (Rule number one for any competitors who might happen to be reading this: if you make authors use MS Word, add another two months to the schedule.) With Dave Thomass retirement in 2016, Andy Hunt is doing a fine job of running the ship, and its always a pleasure to work with the staff there, including Susannah Davidson Pfalzer and Janet Furlow. Most of all, its important to have an editor whom I click with. Rebecca Gulick keeps me from going too deep into the woods of pounding out replicable instructions and makes sure I deliver the big picture themes and ideas of every chapter. Finally, I want to give a shout out to Pragss other iOS authors, including Jeff Kelley, Christina Moulton, Marcus Zarra, and Erica Sadun. And to Janie Clayton, who had other obligations and couldnt be a big part of this edition, but is always available on Twitter for constructive feedback or at least pictures of cooking and pugs.
Ive had a day job doing Swift for a couple years now, and the important thing about it isnt just the language, but also working in an environment where the craft and quality of the code is of such high importance. So thanks to all my colleagues at MathElf (http://mathelf.com) for all the rigor in peer reviews, and Dan Kokotov in particular for pushing me hard to move past twenty years of accumulated bad habits.
In this edition, weve based our major example around writing a podcast client app. Part of the reason we did this is because there are so many good podcasts by and for iOS developers; hopefully, youll check some of them out. Thanks to the CocoaConf Podcast (Dave Klein, Daniel Steinberg, and Cesare Rocchi) and Core Intuition (Daniel Jalkut and Manton Reece) for letting us feature them in our sample code and screenshots.
A big part of Pragss books is the feedback cycle, and this title benefits greatly from the input of our tech reviewers: Zach Jaquish, Jeff Kelley (him again!), Kevin Kim, and Scott Stevenson. Im also grateful to everyone who posted to the books forum or submitted errata during the books beta, including (but hardly limited to) Mark Horrocks, David Lindelf, Noah Patterson, Sean M. Paus, and Robert Sherwood.
Personally, its been a difficult couple of years. Thanks to everyone I leaned on through iMessage or Twitter DM.
Obligatory end-of-book music check: this time it was Manic Street Preachers, BABYMETAL, Of Monsters and Men, The Flaming Lips, David Bowie, and Electric Light Orchestra. Current musical stats at http://www.last.fm/user/invalidname.
Copyright 2017, The Pragmatic Bookshelf.
Early Praise for iOS 10 SDK Development
iOS 10 SDK Development offers programmers an approachable, no-nonsense introduction to iOS development with Swift, leveraging the simplicity of Xcodes Playground support to have readers tinkering with real code in the first pages of the book. Careful elaboration of Swifts many unique features, and how Apples iOS frameworks work with it, will leave readers with a solid foundation for pursuing whatever iOS development ambitions they have in mind.
Daniel Jalkut |
Founder, Red Sweater Software |
I like this book. I like its approach to building something real in Swift. The result is an app that feels good and is useful. Along the way, you learn the basics of iOS development from an experienced pro. Highly recommended.
Eric J. Knapp |
Program director, Mobile Applications Development, Madison College |