ebook img

iOS 9 Swift Programming Cookbook - All IT eBooks PDF

713 Pages·2015·9.8 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 Swift Programming Cookbook - All IT eBooks

iOS 9 Swift Programming Cookbook Vandad Nahavandipoor iOS 9 Swift Programming Cookbook by Vandad Nahavandipoor Copyright © 2016 Vandad Nahavandipoor. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/institutional sales department: 800-998-9938 or [email protected]. Editors: Rachel Roumeliotis and Andy Oram Production Editor: Nicole Shelby Copyeditor: Kim Cofer Proofreader: James Fraleigh Indexer: Judy McConville Interior Designer: David Futato Cover Designer: Ellie Volckhausen Illustrator: Rebecca Demarest December 2015: First Edition Revision History for the First Edition 2015-12-08: First Release See http://oreilly.com/catalog/errata.csp?isbn=9781491936696 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. iOS 9 Swift Programming Cookbook, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. While the publisher and the author have used good faith efforts to ensure that the information and instructions contained in this work are accurate, the publisher and the author disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. 978-1-491-93669-6 [LSI] Preface When I started writing this edition of this book (which has been in the field and regularly updated since iOS version 4), I thought to myself: what I should do to really overhaul it and make it even more exciting than the previous editions? The answer was to rewrite the whole book — every single word from scratch. Up to and including the iOS 8 Swift Programming Cookbook (where I made the big switch from Objective-C to Swift) was to base every edition on the previous edition. I would go through all the examples from the previous edition to remove the ones that were irrelevant for the new edition or just expendable because they were very simple and basic. I’d then update the remaining examples to make sure they work great with the new iOS version. Then I would also write new content for the new version of iOS. However, after 5 editions, I noticed that many recipes were not really useful anymore and had stayed almost the same since the beginning. So how could I solve this issue? The solution was to not do this any longer. I had to write all new content, and that’s what I did for this book. The amount of work that went into writing this book was tremendous, on my side and on O’Reilly’s side. I have had to think long and hard about every new recipe, writing all the example code anew and ensuring it works with the latest production tools from Apple. You will learn a lot about Swift 2 and iOS 9 SDK in this book. And yes, there is a great deal of watchOS material in this book. The chapter dedicated to watchOS has more content in it than any other chapter. The reason behind that decision was that watchOS was the main focus for this year’s WWDC and that Apple has paid more attention to watchOS in iOS 9 SDK than to other frameworks or tools that they have published this year. I hope you’ll enjoy writing watchOS apps as much as I do. One last thing. Since Swift changes a lot and is constantly updated, please always check the GitHub repo for this book to get the most up-to-date code. I have ensured that all code compiles and works fine with Xcode 7 and the iOS 9 SDK, but if for some reason you are on a beta Xcode that is newer than the production version of Xcode 7 that Apple has released, do ensure that you have the latest code by checking out this book’s GitHub repo. Have fun and I hope you’ll enjoy reading this book. Audience I assume that you are comfortable writing iOS apps, at least know your way around Xcode, and can work with the simulator. This book is not for beginners. If you have never programmed in Xcode before for iOS, it will be tough to learn iOS programming only from this book. So I suggest that you complement your skills with other online resources. The best market for this book is intermediate and advanced users. I also assume that you have written a little bit of Swift code. In this book, I use Swift 2 and will teach you some of the concepts, but if you don’t know Swift, this is not the right place to start. Please pick up Apple’s book on Swift programming first; try with that and once you are a bit comfortable with Swift, come back to this book and I’m sure you’ll learn a lot of new things, even about Swift 2. Organization of This Book Here I’ll explain what each chapter is about so that you’ll get a feeling for what this book is going to teach you: Chapter 1, Swift 2.0, Xcode 7, and Interface Builder In this chapter, we go through a lot of new stuff in Swift, Xcode, and Interface Builder (IB), such as the addition of the guard keyword to Swift and conditionally extending types with Swift’s new runtime features. Swift has really matured with Swift 2, and I want to share some of the most important additions with you. Chapter 2, Apple Watch This year’s WWDC star, without a doubt, is watchOS 2 with all its additions. Now apps can run natively on the watchOS without having to talk to the iOS counterpart app, and this is great for us. More work, more things to do, more fun. We will talk about complications, transferring files between iOS and watchOS 2 apps, downloading files right on the watch, recording audio, and playing multimedia on your watch. Chapter 3, The User Interface Even though additions to UIKit were not talked about as extensively as watchOS 2 at this year’s WWDC, there are still tons of new features that we can discuss, including anchored constraints, stack views, and the new Safari view controller. Chapter 4, Contacts The all-new contacts APIs will be discussed in this chapter. The frameworks on which this chapter is based are both completely new to iOS 9. With the APIs in these frameworks, you’ll learn how to add new contacts to the user’s device, remove contacts, edit them, or even allow the user to pick a contact from the list so that you can perform your tasks on it. Chapter 5, Extensions Safari Content Blockers shocked a lot of developers during this year’s WWDC. This allows us developers to create apps that get installed as extensions on the user’s Safari browser, and allows us to block various elements of web pages that the user views. For instance, you can now block pictures or various unwanted elements in the websites that you specify in your app, and you can share these content blockers with those who use your app. This chapter is all about new extension points that you can add to your apps. Chapter 6, Web and Search

Description:
Additional Resources This book is not for beginners, so I assume you have already gotten a grip on Swift and can do basic things with it. Please read Apple’s
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.