About This E-Book
EPUB is an open, industry-standard format for e-books. However, support for EPUB and its many features varies across reading devices and applications. Use your device or app settings to customize the presentation to your liking. Settings that you can customize often include font, font size, single or double column, landscape or portrait mode, and figures that you can click or tap to enlarge. For additional information about the settings and features on your reading device or app, visit the device manufacturers Web site.
Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the e-book in single-column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a Click here to view code image link. Click the link to view the print-fidelity code image. To return to the previous page viewed, click the Back button on your device or app.
SamsTeachYourself iOS9 Application Development in 24 Hours
John Ray
800 East 96th Street, Indianapolis, Indiana, 46240 USA
Sams Teach Yourself iOS9 Application Development in 24 Hours
Copyright 2016 by Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, request forms, and the appropriate contacts within the Pearson Education Global Rights & Permissions Department, please visit www.pearsoned.com/permissions/. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.
ISBN-13: 978-0-672-33767-3
ISBN-10: 0-672-33767-3
Library of Congress Control Number: 2015917495
First Printing February 2016
Editor-in-Chief
Greg Wiegand
Acquisitions Editor
Laura Norman
Development Editor
Keith Cline
Managing Editor
Kristy Hart
Senior Project Editor
Lori Lyons
Copy Editor
Keith Cline
Indexer
Publishing Works
Proofreader
Laura Hernandez
Technical Editor
Anne Groves
Editorial Assistant
Sandra Fugate
Cover Designer
Mark Shirar
Compositor
Nonie Ratcliff
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Sams Publishing cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an as is basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book.
Special Sales
For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at or (800) 382-3419.
For government sales inquiries, please contact .
For questions about sales outside the U.S., please contact .
About the Author
John Ray currently serves as the Director of the Office of Research Information Systems at The Ohio State University. He has written numerous books for Macmillan/Sams/Que, including Using TCP/IP: Special Edition, Teach Yourself Dreamweaver MX in 21 Days, Mac OS X Unleashed, My OS X El Capitan Edition, and Sams Teach Yourself iOS 8 Development in 24 Hours. As a Macintosh user since 1984, he strives to ensure that each project presents the Macintosh with the equality and depth it deserves. Even technical titles such as Using TCP/IP contain extensive information about the Macintosh and its applications and have garnered numerous positive reviews for their straightforward approach and accessibility to beginner and intermediate users.
You can visit his website at http://teachyourselfios.com or follow him on Twitter at @johnemeryray or #iOSIn24.
Dedication
This book is dedicated to the stray cat living in my garage.
It appears to like the cat food I bought.
Acknowledgments
Thank you to the group at Sams PublishingLaura Norman, Keith Cline, Mark Renfrowand my Tech Editor, Anne Groves, for helping me survive another year of OS and Xcode updates. The evolution of Swift (and the Xcode tools) has been incredibly rapid, and the ride for developers is definitely a bit bumpy. The Pearson team does a great job of keeping me organized, honest, and on target.
We Want to Hear from You!
As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what were doing right, what we could do better, what areas youd like to see us publish in, and any other words of wisdom youre willing to pass our way.
We welcome your comments. You can email or write to let us know what you did or didnt like about this bookas well as what we can do to make our books better.
Please note that we cannot help you with technical problems related to the topic of this book.
When you write, please be sure to include this books title and author as well as your name and email address. We will carefully review your comments and share them with the author and editors who worked on the book.
Email:
Mail: Sams Publishing
ATTN: Reader Feedback
800 East 96th Street
Indianapolis, IN 46240 USA
Reader Services
Register your copy of Sams Teach Yourself iOS 9 Application Development at . Enter the product ISBN, 9780672337673, and click Submit. Once the process is complete, you will find any available bonus content under Registered Products.
Be sure to check the box that you would like to hear from us in order to receive exclusive discounts on future editions of this product.
Introduction
When you pick up an iOS device and use it, you feel connected. Whether it be an iPad, an iPhone, or an iPod, the interface acts as an extension to your fingers; it is smooth, comfortable, and invites exploration. Other competing devices offer similar features, and even sport gadgets such as wraparound screens and trackpads, but they cannot match the user experience that is iOS.
iOS and its associated development tools have changed rapidly over the past few years. iOS 7 brought us a new user interface that used depth and translucency to keep users connected to their content and aware of the context in which they are accessing it. iOS 8 surprised everyone with a brand new language for developing apps: Swift. Alongside the introduction of iOS 9, Swift became an open source language, solidifying it as the future of development on Apple platforms and beyond.