Swift 3 New Features
eBook - ePub

Swift 3 New Features

Keith Elliott

Share book
  1. 142 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Swift 3 New Features

Keith Elliott

Book details
Book preview
Table of contents
Citations

About This Book

A fast-paced guide to get you up and running with Swift 3 and its new features

About This Book

  • Get up to date with the latest changes to Swift 3
  • Make your life easier by knowing how to port your Swift code to the latest version
  • Learn how to write programs that work on most of the major platforms such as iOS and Linux

Who This Book Is For

The book is for those who are familiar with Swift but are in need of clear guidance on what's changed in the latest version and the new features.

What You Will Learn

  • Migrate a Swift 2.2 project to Swift 3
  • Understand the workings of Swift Package Manager
  • Interact with Cocoa libraries when importing Objective C to Swift
  • Explore the function and operator changes new in Swift 3
  • Work with the advanced type changes, attribute improvements, and floating point type improvements in Swift
  • Discover the changes in the Swift API and see how Objective-C can be manipulated in the current API
  • Implement the new features central to Swift Testing and understand the new debug features
  • Create server-side applications using Swift 3

In Detail

Since Swift was introduced by Apple in WWDC 2015, it has gone on to become one of the most beloved languages to develop iOS applications with. In the new version, the Swift team aimed to take its adoption to the next level by making it available for new platforms and audiences.

This book will very quickly get you up to speed and productive with Swift 3. You will begin by understanding the process of submitting new feature requests for future versions of Swift. Swift 3 allows you to develop and run your applications on a Linux machine. Using this feature, you will write your first Linux application using the debugger in Linux. Using Swift migrator, you will initiate a conversion from Swift 2.2 to Swift 3.

Further on, you will learn how to interact with Cocoa libraries when importing Objective C to Swift. You will explore the function and operator changes new to Swift 3, followed by Collection and Closure changes. You will also see the changes in Swift 3 that allow you write tests easier with XCTest and debug your running code better with new formats as well. Finally, you will have a running server written completely in Swift on a Linux box.

By the end of the book, you will know everything you need to know to dive into Swift 3 and build successful projects.

Style and approach

The book takes a tutorial-based approach offering an overview of the new features introduced in the latest version of Swift. It includes relevant examples of how code and concepts change when it comes to working on Swift 3 compared to previous versions.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Swift 3 New Features an online PDF/ePUB?
Yes, you can access Swift 3 New Features by Keith Elliott in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781786469632
Subtopic
Programming
Edition
1

Swift 3 New Features


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 wife’s 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 [email protected] 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.
www.PacktPub.com
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 Swift’s 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

Chapter 1, 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 Apple’s Github page as the repositories for everything that is happening in Swift.
Chapter 2, 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.
Chapter 3, 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.
Chapter 4, 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.
Chapter 5, Function and Operator Changes – New Ways to Get Things Done, will examine what's changed in function declaration and usage and how those changes translate into better Swift code. We will also explain operator changes and highlight several that have been removed from the language.
Chapter 6, Extra, Extra Collection and Closure Changes That Rock!, here we are focusing on collection and closure changes in Swift 3. There are several nice additions that will make working with collections even more fun. We will also explore some of the confusing side effects of creating closures in Swift 2.2 and how those have been fixed in Swift 3.
Chapter 7, Hold onto Your Chair, Advanced Type Changes are Here!, We are going to cover a few improvements to the language that you might not use on a regular basis. This chapter focuses on UnsafePointer types, typealiases, and floating point operations.
Chapter 8, Oh Goodness! Look What is New in the Foundation Framework,...

Table of contents