Swift 3 New Features
Copyright 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2016
Production reference: 1041016
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78646-963-2
www.packtpub.com
Credits
Author Keith Elliott | Copy Editor Charlotte Carneiro |
Reviewer Arthur Ariel Sabintsev | Project Coordinator Sheejal Shah |
Commissioning Editor Ashwin Nair | Proofreader Safis Editing |
Acquisition Editor Reshma Raman | Indexer Tejal Daruwale Soni |
Content Development Editor Divij Kotian | Graphics Jason Monteiro |
Technical Editor Gebin George | Production Coordinator Aparna Bhagat |
About the Author
Keith Elliott is a multitalented professional with unique business and technology experience spanning telecommunications, real estate investment banking, and capital markets. His work is driven simply by problems that need solutions, whether the problem is as simple as his wifes request for a custom to-do list or as complex as interest rate derivatives and foreign exchange hedging. He graduated with an MBA from Columbia Business School with an emphasis in entrepreneurship and an undergraduate degree from Georgia Institute of Technology with a bachelor's in computer engineering.
Keith's own company, GittieLabs LLC, works with startups to provide technology solutions. His vision is to equip students with the real-life experience necessary to succeed in startup and corporate life. You can find his blog on the GittieLabs LLC website, www.gittie.com.
On nights and weekends, Keith can be found spending time with his family, riding motorcycles with his lovely wife, watching football, and rewatching countless hours of WWDC videos.
I would like to thank my wife Grace, children Jadyn, Avery, Tobias, and Cohen, and his little dog Gideon for inspiring and helping me fulfill my dreams.
About the Reviewer
Arthur Ariel Sabintsev is one of the lead iOS engineers at The Washington Post . His mobile engineering career includes working for a U.S. Government-funded digital identity startup (ID.me), a Techstars funded video startup (Shelby.tv), and an award winning mobile development agency (Fueled).
He's also spent the last 3 years teaching Swift and Objective-C for General Assembly and writing over a dozen open source iOS libraries for the general public. Before leaving his PhD program, he was an experimental nuclear physicist who worked underground colliding subatomic and subnuclear particles.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Preface
With the release of Swift 3, Apple is seeking to increase adoption of Swift. The mission of this book is to very quickly get new and seasoned developers up to speed and productive with Swift 3. We will explore the major features introduced to Foundation and the Standard Library. We will also provide commentary on how to convert existing Swift 2.2 projects to Swift 3 and examine Swifts support for running and developing on Linux.
Objectives and achievements
My objective is to introduce you to new concepts available with the release of Swift 3. Our journey together will hopefully lead you to a greater understanding in the following areas:
- Understanding how the Grand Renaming will make your code easier to write and understand by other developers
- Getting comfortable with the tools available to write Swift applications on a Mac or on Linux
- Converting your Swift 2.2 projects to Swift 3
- Making you aware of the syntax changes new to Swift 3
What this book covers
, What Were They Thinking? , introduces you to Swift 3. Swift is an important language for Apple and its adoption rate has been amazing so far. We will cover the process for how changes to the language are selected and how the community can contribute. In addition, we will cover Swift.org and Apples Github page as the repositories for everything that is happening in Swift.
, Discovering New Territories - Linux at Last! , discusses that, while Mac development was your only supported option up until recently, Swift 3 supports developing and running Swift applications on a Linux machine. Our goal is get your development environment setup on both a Mac and a Linux machine by the end of this chapter. We will write our first Linux application together.
, Migrating to Swift 3 to Be More Swifty, will show how to use the Swift Migrator to upgrade our Swift 2.2 projects. We will use a sample project to walk through using the migrator and outline some useful strategies when migrating a Swift project.
, Changes to Swift's Core Will Have Asking for More , will quickly highlight the philosophies for writing good Swift APIs. Afterwards, we will spend the remaining chapter on language improvements for referencing and using Objective-C features in Swift 3 and importing code from Objective-C and C to Swift 3.