ebook img

iOS 9 by Tutorials: Learning the new iOS 9 APIs with Swift 2 PDF

297 Pages·50.292 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 9 by Tutorials: Learning the new iOS 9 APIs with Swift 2

iOS 9 by Tutorials By the raywenderlich.com Tutorial Team Jawwad Ahmad, Soheil Azarpour, Caroline Begbie, Evan Dekhayser, Aaron Douglas, James Frost, Vincent Ngo, Pietro Rea, Derek Selander, & Chris Wagner Copyright © 2015 Razeware LLC. All rights reserved. No part of this book or corresponding materials (such as text, images, or source code) may be reproduced or distributed by any means without prior written permission of the copyright owner. This book and all corresponding materials (such as source code) are provided on an "as is" basis, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software. All trademarks and registered trademarks appearing in this book are the property of their respective owners. Dedications "To my parents, my wife, and two daughters, for their support and encouragement." — Jawwad Ahmad "To my lovely, always supportive wife Elnaz, our son Kian and my parents." — Soheil Azarpour "To Ken who always encouraged me not to get a real job. Also to my weird and wonderful children Robin and Kayla - love you both!" — Caroline Begbie "To my parents, for funding and supporting my expensive hobby." — Evan Dekhayser "To my husband, Mike, and my parents - all whom have inspired me to do my best and keep plugging away throughout the years." — Aaron Douglas "To my wonderful, ever-patient wife Hannah, and our son Rupert, who amazes me every day." — James Frost "To my parents and sister for always encouraging, and helping me along my journey. I ♥ you guys so much!" — Vincent Ngo "To my wife Emily and my father Aldo." — Pietro Rea "Thanks to Brittany & our doggie, Squid, for all the love and support... as well as constantly licking me when I sleep." — Derek Selander "To my beautiful wife Sam, our ever curious son Hayden, and most recent addition to the family Ryland." — Chris Wagner About the authors Jawwad Ahmad is a freelance iOS Developer that dove into Swift head first and has not looked back. He enjoys mentoring and teaching and was the original founder of the of the NYC iOS Study Group. He's worked for companies as large as The New York Times, and as small as GateGuru, a 6 person startup. Soheil Azarpour is an engineer, developer, author, creator, husband and father. He enjoys bicycling, boating and playing piano. He lives in Manchester, NH. Soheil creates iOS apps professionally and independently. Caroline Begbie is an indie iOS developer and likes to relax with animation software, Arduino and electronics. In her previous life she taught the elderly how to use their computers, performed marionette shows in schools, and ran a software company in Silicon Valley. Evan Dekhayser is a high school student, as well as an iOS developer. He first learned Python in 2012, and has since built up his knowledge of Objective C and Swift. He enjoys playing and watching baseball, and is always looking for intriguing topics to learn and potentially write about. Aaron Douglas was that kid taking apart the mechanical and electrical appliances at five years of age to see how they worked. He took an early interest in computer programming, figuring out how to get past security to play games on his dad's computer. He's still that feisty nerd, but at least now he gets paid to do it. Aaron works for Automattic (WordPress.com, Akismet, SimpleNote) as a Mobile Maker. Twitter: @astralbodies Blog: http://astralbodi.es James Frost is a senior iOS developer at Mubaloo Ltd, and lives in Bristol, UK. He taught himself to code in the early 90s on his family's BBC B, and was instantly hooked. He loves learning new things and teaching others, and enjoys spending time with his wife and son, reading, playing games, and cooking. You can find him on his blog at: http://www.jamesfrost.co.uk or as @frosty on Twitter. Vincent Ngo is a full time iOS software engineer at IBM. He graduated from Virginia Tech with a Computer Science degree. He has passion for developing, sharing, and learning about what's new with the iOS SDK. On the side he loves playing video games, strumming his guitar, hitting golf balls, and chilling with friends. Pietro Rea is a software engineer at Quidsi, where he builds e-commerce iOS applications for Diapers.com, Wag.com, Soap.com and 7 other brands. Previously, he's worked on the Huffington Post's mobile team. You can find Pietro on Twitter as @pietrorea. Derek Selander is an iOS developer who enjoys learning through debugging & disassembly to see how others have solved similar problems. In his free time, he enjoys surfing, playing classical guitar, and consuming bacon. Chris Wagner leads iOS development at Infusionsoft and has been developing for iOS since the release of the SDK in 2009. His background consists of gaming, customer support, systems administration and web development. When he's not working he enjoys spending time with his wife and son. By the time this is published our second son will have arrived! About the editors James Frost was a technical editor for this book. He is a senior iOS developer at Mubaloo Ltd, and lives in Bristol, UK. He taught himself to code in the early 90s on his family's BBC B, and was instantly hooked. He loves learning new things and teaching others, and enjoys spending time with his wife and son, reading, playing games, and cooking. You can find him on his blog at: jamesfrost.co.uk or as @frosty on Twitter. Jeff Rames was a technical editor for this book. He is a developer currently working at AirStrip where he builds enterprise iOS products in the healthcare space. He discovered his passion for mobile software shortly after the iPhone SDK was released, and made it his full time gig in 2011 after a decade in the industry. He spends his free time with his wife and daughters, except when he abandons them for trips to Cape Canaveral to watch rockets being launched into space. Richard Turton was a technical editor for this book. He is an iOS developer for MartianCraft, prolific Stack Overflow participant and author of a development blog, Command Shift. When he's not in front of a computer he is usually building Lego horse powered spaceships (don't ask!) with his daughter. Chris Belanger was an editor for this book. He spends his days developing real-time industrial control applications; he fills the rest of his time with writing, editing, travelling, composing music, enjoying the great outdoors and appreciating the finer things in life. He's excited to have worked on yet another book with the raywenderlich.com team and can't imagine life without this crazy, wonderful bunch. Wendy Lincoln was an editor for this book. By day, she manages complex content development projects and by night she escapes into the world of iOS. Before all this, she produced a cooking show named Hot Kitchen, wrote a cookbook and taught cooking classes. A few years ago she realized her love for writing, editing and playing with computers; she's never looked back. Once in a while, her husband manages to tear her away from the computer for trips to the beach and random home improvement projects. Sam Davies was the final pass editor for this book. Sam is a strange mashup of developer, writer and trainer. By day you'll find him recording videos for Razeware, writing tutorials, attending conferences and generally being a good guy. By night he's likely to be out entertaining people, armed with his trombone and killer dance moves. He'd like it very much if you were to say "hi" to him on twitter at @iwantmyrealname. About the artist Julien Martin was the artist for the book. After years working in print, Julien discovered an unquenchable passion for icon and interface design while working with startups in New York City. Back home in France, he has since designed multiple successful and award-winning mobile apps for established businesses, entrepreneurs and passionate individuals who value the importance of great design. You can get in touch via http://julien.design. iOS 9 by Tutorials Table of Contents: Overview Introduction................................................................................ 13 Chapter 1: Swift 2.0............................................................... 21 Chapter 2: Introducing App Search..................................... 41 Chapter 3: Your App on the Web........................................ 60 Chapter 4: App Thinning........................................................ 79 Chapter 5: Multitasking.......................................................... 96 Chapter 6: 3D Touch............................................................. 109 Chapter 7: UIStackView & Auto Layout changes ........... 126 Chapter 8: Intermediate UIStackView.............................. 145 Chapter 9: What's New in Storyboards?......................... 166 Chapter 10: Custom Segues ............................................... 185 Chapter 11: UIKit Dynamics................................................ 205 Chapter 12: Contacts........................................................... 222 Chapter 13: Testing .............................................................. 239 Chapter 14: Location and Mapping ................................. 258 Chapter 15: What's New in Xcode?.................................. 276 Conclusion ............................................................................... 297 raywenderlich.com 8 iOS 9 by Tutorials Table of Contents: Extended Introduction................................................................................ 13 What you need.................................................................................................................. 14 Who this book is for.......................................................................................................... 14 How to use this book......................................................................................................... 15 Book overview.................................................................................................................... 15 Book source code and forums......................................................................................... 19 Book Updates..................................................................................................................... 19 License.................................................................................................................................. 19 Acknowledgments.............................................................................................................. 20 Chapter 1: Swift 2.0............................................................... 21 Whither Swift?.................................................................................................................... 21 The Real "One more thing".............................................................................................. 21 What Makes Swift, "2.0"?............................................................................................... 22 The Logistics........................................................................................................................ 22 Control Flow........................................................................................................................ 23 Error handling..................................................................................................................... 25 The Project........................................................................................................................... 27 Additional Things............................................................................................................... 35 Where to go from here?.................................................................................................. 40 Chapter 2: Introducing App Search..................................... 41 App search APIs................................................................................................................. 41 Getting started.................................................................................................................. 43 Searching previously viewed records............................................................................ 44 Indexing with Core Spotlight........................................................................................... 51 Private vs. public indexing............................................................................................... 56 Advanced features............................................................................................................ 57 Where to go from here?.................................................................................................. 58 Chapter 3: Your App on the Web........................................ 60 Getting started.................................................................................................................. 60 Linking to your app........................................................................................................... 62 Working with web markup.............................................................................................. 71 Where to go from here?.................................................................................................. 77 raywenderlich.com 9 iOS 9 by Tutorials Chapter 4: App Thinning........................................................ 79 Getting started.................................................................................................................. 80 Slicing up app slicing........................................................................................................ 83 Being smart with resources............................................................................................... 84 Lazily (down)loading content........................................................................................... 86 Make it download faster.................................................................................................. 89 The many flavors of tagging........................................................................................... 91 Purging content................................................................................................................... 93 Where to go from here?.................................................................................................. 94 Chapter 5: Multitasking.......................................................... 96 Getting started.................................................................................................................. 96 Preparing your app for multitasking............................................................................. 98 Orientation and size changes.......................................................................................... 98 Adaptive presentation ................................................................................................... 103 Other considerations....................................................................................................... 107 Where to go from here?................................................................................................ 108 Chapter 6: 3D Touch............................................................. 109 Getting started................................................................................................................ 110 UITouch force.................................................................................................................... 111 Peeking and popping..................................................................................................... 113 Home screen quick actions............................................................................................. 119 Where to go from here?................................................................................................ 125 Chapter 7: UIStackView & Auto Layout changes ........... 126 Getting started................................................................................................................ 127 Your first stack view........................................................................................................ 130 Layout anchors................................................................................................................. 136 Layout guides................................................................................................................... 140 Fixing the alignment bug............................................................................................... 140 Where to go from here?................................................................................................ 144 Chapter 8: Intermediate UIStackView.............................. 145 Getting started................................................................................................................ 145 Converting the sections................................................................................................... 146 Alignment.......................................................................................................................... 151 Convert the weather section.......................................................................................... 152 Animation.......................................................................................................................... 162 raywenderlich.com 10

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.