ebook img

iOS 8 SDK Development: Creating iPhone and iPad Apps with Swift PDF

288 Pages·2016·14.82 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview iOS 8 SDK Development: Creating iPhone and iPad Apps with Swift

Early praise for iOS 8 SDK Development Not many books cover both programming interfaces and deeper software engineer- ing topics. It’s refreshing to see both covered, expertly, in one book. Chris and Janie are masters at making technical content approachable. It’s like having two of your best friends teaching you iOS. ➤ Mark Dalrymple Author of Advanced Mac OS X Programming: The Big Nerd Ranch Guide and co-founder of CocoaHeads, the international Mac and iOS programming com- munity iOS 8 SDK Development is a fantastic resource for learning how to make a modern iOS app. Whether you’re new to iOS in general or just new to Swift, you will leave the book with a fully functional, modern iOS app with all of the most important features covered. This book is my new go-to recommendation for those looking to get started on the platform. ➤ Jeff Kelley iOS developer at Detroit Labs and author of Learn Cocoa Touch for iOS This is a really good book. The app you will create while you learn Swift and iOS development is even quite usable when you are done. Learning Swift is essential now in the Apple development world, and this book does a great job teaching it. The authors have put a lot of thought and craft into it, and you will benefit. I highly recommend it. ➤ Eric Knapp Program Director, Mobile Applications Development, Madison College Whether you’re new to iOS programming or just need some help getting up to speed on iOS 8 and Swift, this is the perfect book for you. Chris and Janie take you on a well-thought-out and fun journey into iOS SDK development. ➤ Dave Klein Founder of CocoaConf and author of Grails: A Quick-Start Guide iOS 8 SDK Development is an excellent book for experienced developers hoping to develop iOS applications professionally. It is a guided tour of the Swift language, an extended SDK tutorial using a variety of modern iOS APIs, and a showcase of effective techniques for organizing and editing projects in the latest version of Xcode. ➤ Steven Huwig A new programming language and new APIs. Whether you are a seasoned devel- oper or a beginner, there’s a lot to learn in the new iOS 8 SDK. Chris and Janie take your hand and walk you through Swift and the new APIs, providing great insights and detailed explanations while building a real application. ➤ Cesare Rocchi Studio Magnolia iOS 8 SDK Development Creating iPhone and iPad Apps with Swift Chris Adamson Janie Clayton The Pragmatic Bookshelf Dallas, Texas • Raleigh, North Carolina 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, PragProg and the linking g device are trade- marks 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. 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 https://pragprog.com. The team that produced this book includes: Rebecca Gulick (editor) Potomac Indexing, LLC (indexer) Liz Welch (copyeditor) Dave Thomas (typesetter) Janet Furlow (producer) Ellie Callahan (support) For international rights, please contact [email protected]. Copyright © 2015 The Pragmatic Programmers, LLC. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. Printed in the United States of America. ISBN-13: 978-1-941222-64-5 Encoded using the finest acid-free high-entropy binary digits. Book version: P2.0—May 2015 Contents Acknowledgments . . . . . . . . . . . ix Introduction . . . . . . . . . . . . xiii 1. Playing Around with Xcode . . . . . . . . . 1 Xcode Playgrounds 1 Digging Into the Docs 6 Wrap-Up 8 2. Building Adaptive User Interfaces . . . . . . . . 9 Our First Project 9 The Xcode Window 11 Building Our User Interface 14 Autolayout 19 Connecting User Interface to Code 23 Coding the App 26 Wrap-Up 30 3. Programming in Swift for iOS . . . . . . . . 31 Introducing Swift 31 Managing an Object’s Properties 36 The iOS Programming Stack 45 Building Views with UIKit 45 Strings 48 Collections 49 Optionals 51 Internationalization 54 Wrap-Up 58 Contents • vi 4. Testing Apps . . . . . . . . . . . . 61 Unit Tests 61 Creating Tests in Xcode 63 Test-Driven Development 66 Creating Tests 67 Testing Asynchronously 71 Testing Frameworks 75 Wrap-Up 77 5. Presenting Data in Table Views . . . . . . . . 79 Tables on iOS 79 Table Classes 80 Creating and Connecting Tables 81 Filling In the Table 85 Customizing Table Appearance 90 Cell Reuse 92 Custom Table Cells 93 Pull-to-Refresh 99 Wrap-Up 101 6. Waiting for Things to Happen with Closures . . . . 103 Setting Up Twitter API Calls 104 Encapsulating Code in Closures 105 Using the Twitter SLAccount 107 Making a Twitter API Request 108 Parsing the Twitter Response 110 Wrap-Up 112 7. Doing Two Things at Once with Closures . . . . . 113 Grand Central Dispatch 114 Concurrency and UIKit 114 Do-It-Yourself Concurrency 120 Wrap-Up 124 8. Growing Our Application . . . . . . . . . 127 Working with Multiple View Controllers 127 Refactoring in Xcode 128 Building Our Own Delegate 131 Making the Twitter Code More General-Purpose 133 Using Another TwitterAPIRequest 136 Wrap-Up 137 Contents • vii 9. Navigating Between View Controllers . . . . . . 139 Navigation Controllers 139 The Navigation Bar 142 Navigating Between View Controllers 144 Using the Storyboard Segue 146 Sharing Data Between View Controllers 147 Modal Navigation 154 Exit Segues 159 Wrap-Up 161 10. Taking Advantage of Large Screens . . . . . . . 163 Split Views on iPad 164 Split Views on the iPhone 170 Size Classes and the iPhone 6 173 Wrap-Up 178 11. Recognizing Gestures . . . . . . . . . . 179 Gesture Recognizers 179 Pinching and Panning 184 Affine Transformations 186 Transforming the Image View 187 Subview Clipping 192 Wrap-Up 194 12. Working with Photos . . . . . . . . . . 195 Photo Assets and PHAsset Class 195 Fetching Our Assets 196 Core Image 201 Wrap-Up 205 13. Launching, Backgrounding, and Extensions . . . . 207 The App Life Cycle 207 Opening via URLs 208 App Extensions 215 Creating a Keyboard Extension 216 Wrap-Up 225 14. Debugging Apps . . . . . . . . . . . 227 println(): The First Line of Defense Against Bugs 227 Breakpoints 229 Setting Up Your Debugging Environment 237 Wrap-Up 239 Contents • viii 15. Publishing to the App Store . . . . . . . . 241 Protecting Our Code with Source Control 241 Running on the Device 246 Icons and Launch Images 252 Submitting Apps for Review 255 After We Ship 260 Onward! 262 Index . . . . . . . . . . . . . . 265

Description:
2nd Edition. — The Pragmatic Programmers, 2015. — 288 p. — ISBN-10: 1941222641, ISBN-13: 978-1-941222-64-5.The iOS 8 SDK changes everything. New programming language, new ways to work with other apps, new tools to do cool stuff. In a world of iPhones and iPads, it's a great time to make a fres
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.