Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Swift 3 New Features
Swift 3 New Features

Swift 3 New Features: Get up to date with what`s new in Swift 3

Arrow left icon
Profile Icon Elliott
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
Paperback Oct 2016 142 pages 1st Edition
eBook
S$12.99 S$35.99
Paperback
S$44.99
Subscription
Free Trial
Arrow left icon
Profile Icon Elliott
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
Paperback Oct 2016 142 pages 1st Edition
eBook
S$12.99 S$35.99
Paperback
S$44.99
Subscription
Free Trial
eBook
S$12.99 S$35.99
Paperback
S$44.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Swift 3 New Features

Chapter 1. What Were They Thinking?

Apple's release of Swift was a smashing hit from the very beginning. The language generated a lot of hype and it delivered. Of course, with the introduction of any new programming language, problems and issues will come along for the ride. Apple has carefully cultivated the young language, and has been steadily improving its base and introducing new features, support, and compatibility with its long mainstay incumbent, Objective-C. So, why would Apple open-source the language? What is Apple's objective and what does that tell us about the forthcoming release of Swift 3?

The focus of this chapter is to discuss Apple's goals for Swift 3, to show you where you can find the source of official information about new and current development in the language, and to explain how the community of developers will shape the fate of Swift as a language.

Apple's goals for Swift 3

During the What's New In Swift lecture from Apple's World Wide Developer Conference (WWDC) 2016, Apple engineers outlined several goals for the upcoming release of Swift 3:

  • Develop an open community
  • Portability to new platforms
  • Get the fundamentals right
  • Optimize for awesomeness

Note

If you missed the conference, you can watch a replay of the talk on Apple's developer portal. Here's the link for What's New In Swift: https://developer.apple.com/videos/play/wwdc2016/42.

I want to briefly touch on a couple of themes here as it will provide a base for the material you will find in the remaining chapters:

  • Apple believes that for Swift to grow in adoption it needs a strong community. The path to rapid Swift adoption is to include the voices of the community in its development.
  • Swift is a general-purpose language that could and should run on any platform. Imagine running Swift on Linux or on the Internet of Things (IoT) you create or need to control. Apple believes that the Swift language is so capable that they removed the barriers that tied Swift to running on a Mac, opening endless possibilities for platform portability. Apple wants the community to find ways to get Swift to run on other platforms. Today, the Swift team is supporting a port to Linux. Tomorrow, the Swift team could have official support for a wide range of platforms.
  • In order to make the first two themes possible, the Swift team needs to get things right from the beginning with Swift 3. Unfortunately, this means that the new changes in Swift 3 do not work well with previous releases of Swift. The Swift 3 release will fix and remove things that were awkward in Swift 2 (and its predecessors). Swift 3 also re-imagines how it interacts with Cocoa and Objective-C to make the APIs that bridge them feel more Swifty.

Swift is a really big deal to Apple and expectations from the language are high. Apple has laid out its roadmap for how it expects to reach its goals. In fact, you can stay current with all things Swift by subscribing to one of the mailing lists found here https://swift.org/community/#mailing-lists. The main method for communicating with the Swift community is via mailing lists. You can find mailing lists that cater to general information as well as lists for day-to-day updates on the language. The Swift mailing lists can be a valuable tool that you should not overlook.

In the next section, we will talk about what the open source community means for you as a Swift developer.

Open source Swift

On December 3 2015, Apple open-sourced Swift (including the language, supporting libraries, debugger, and package manager) under the Apache 2.0 license and launched the https://Swift.org/ website on the same day. https://Swift.org/ is the official site to find resources on the various projects that make up Swift. It's your main source to read announcements on all of the development work on the language, from proposals of new features, to links to development branches of Swift code that you can download and test.

https://Swift.org/ is a website that you will want to bookmark for future reference. The entire Swift codebase is hosted on GitHub and is available for anyone to access. Take a second to think about that. Anyone can download Swift, play around with a binary, build a project, or look under the hood to see how things actually work. For a company of Apple's size and reputation, releasing Swift, the language that they are betting on to power all of their applications, to the community is amazing and should not be taken lightly. This is huge!

Naturally, Apple didn't just hand the language over and walk away. Instead, Apple set up an internal team to shepherd the development process and to be responsible for the day-to-day project management. The open sourced version of the Swift language is comprised of a group of projects each hosted as a separate repository on GitHub. Today, you can find links to six active projects:

  • Swift compiler: Command line tool
  • Standard library: Distributed as part of the core language
  • Core libraries: Provide a higher level functionality
  • LLDB debugger: Includes the Swift REPL
  • Swift Package manager: Building projects and distributing them

Each project has a dedicated section on https://Swift.org/ that explains the project goals and links on how to use both Swift and contribute as a community member. I encourage you to review https://Swift.org/ to get a better handle on all things Swift from Apple's perspective. Before we end our section on where to find resources on Swift, I do want to briefly discuss what it means to be a community contributor.

The community structure has been well thought out and it's designed to provide strong leadership from members in the community. This structure will guide the on-going development of the language and will hopefully ensure that as the community expands, many new community contributors will have a voice that is heard and respected. See below for the roles that make up members of the community:

  • Project Lead: Apple is the project lead and will select others from the community to serve in various technical lead positions
  • Core Team: This small team of engineers is responsible for strategic direction
  • Code Owner: This title goes to anyone responsible for a specific area of a Swift project codebase
  • Committer: This role is given to anyone with commit access to a Swift repository
  • Contributor: This role is reserved for anyone who contributes to a patch or helps with a code review

You can read more about the individual roles in the community on https://Swift.org/ under the community section. The Swift community is growing and, not unexpectedly, many developers are curious about  how to contribute. With that in mind, let's explore how things get done.

Contributing to Swift

There are a few ways that you can help make the community and Swift better. Surprisingly, it's not just by cranking out code. The community needs support with answering questions on the mailing lists. Your answers could range from helping a newbie get a better grasp on a new concept to, going to the opposite extreme, helping a seasoned developer work through a subtle bug. Either way, contributing your knowledge could be valuable to others and would be very much appreciated!

The next option for contributing to the Swift project is by either reporting or triaging bugs. The Swift team uses Jira for defect tracking and you can submit bugs on the project's Jira instance located at https://bugs.swift.org.

The final option you have as a developer is to contribute code. There is a formal process for committing code that we will briefly cover. The Swift project prefers small incremental changes to large commits or long-term disconnected feature branches. The Swift team also encourages, but does not enforce, commit messages that describe in detail what your committed code changes include. Code quality is extremely important and is emphasized through mandatory code reviews and pull requests to ensure at least another set of eyes has reviewed all code changes. Think of it this way; your changes will eventually make it into a production environment and have the potential to affect millions of developers that use the Swift language. Do you really want to take of chance introducing a defect that might affect millions of developers?

Swift evolution process

While Apple and the Swift team each have tons of great ideas on where Swift can go, it's important to remember that they aren't the only ones with ideas. In fact, the Swift team fully realizes this, and in response has created a process for you to submit your big or small ideas to help shape the Swift language.

The Swift evolution process encompasses all things related to taking a raw idea from inception through discussion and dialog and hopefully ending at an accepted proposal that developers can implement for production release. The goal of the process is to have active engagement within the community in order to steer the direction of the language while remaining true to the vision of Swift. In practice, that might translate into adding new features that make the language easier to use or removing features that no longer fit the vision of Swift. You can participate by proposing a new idea, or discussing and reviewing the proposals of other community members.

Swift evolution process

Swift evolution proposal steps

Here are the steps required to get a new idea moved into an accepted proposal:

  1. Check for similar proposals: It's important to do your homework and make sure that your idea hasn't already been proposed and/or rejected. Spend time reviewing proposals and their states. You can check the Commonly Rejected Proposals list for this task.
  2. Tell others about your idea: Most of the discussions around new ideas take place on the swift-evolution mailing list. This is where you should create a draft of your idea, along with the problem it addresses and some context on a solution.
  3. Create your proposal: Using the proposal template found here https://github.com/apple/swift-evolution/blob/master/0000-template.md, you elaborate on your idea and continue to socialize it on the evolution mailing list.
  4. Request a review: When you believe your proposal is ready for a formal review by the core team, you submit a pull request to the swift-evolution repository https://github.com/apple/swift-evolution. When your pull request is accepted, your proposal will be given a proposal number and assigned a core team member to facilitate the review.
  5. Respond to feedback: It's your job to respond to questions and feedback on your proposal on the mailing list. This is especially important during the review period.

If all goes well, your proposal will navigate through the proposal states below during the review process and will be accepted.

  • Awaiting review: Until the proposal is assigned a date period for review, your proposal remains in this state.
  • Under review: Your proposal is undergoing public review on the swift-evolution mailing list.
  • Under revision: If you are given feedback during the under-review state, you are given an opportunity to address and modify your proposal.
  • Deferred: Decision postponed because it doesn't meet the criteria for the upcoming major Swift release. In this state, your proposal will be reconsidered when scoping for the next major Swift release.
  • Accepted: Accepted and new work can begin or is actively being done to implement your accepted proposal. An announcement will also go out to let the community know of a new accepted proposal for the upcoming release.
  • Rejected: Considered but rejected by the core team.

Here are some key things to remember about the review process. It doesn't start until a core team member (review manager) accepts your pull request for the proposal. Once accepted, the review manager will coordinate a review period with you and any other authors of the proposal to start a formal public review. The review period is a week long in most cases, but can be longer depending on the scope and complexity of changes outlined in the submitted proposal. Finally, the core team, not just the review manager, will make a decision on the proposal using the comments from the swift-evolution mailing list to help base their decision.

Overview of accepted proposals for Swift 3

Each major release of Swift will have high-level goals to which accepted features must adhere. For the Swift 3 release, the Swift team outlined that the primary goal of this release is to solidify and mature the Swift language and development experience.

In their own words, the Swift team went on to stated that While source code breaking changes to the language have been the norm for Swift 1 through 3, we would like the Swift 3.x (and Swift 4+) languages to be as source-compatible with Swift 3.0 as reasonably possible. However, this will still be best-effort: if there is a really good reason to make a breaking change beyond Swift 3, we will consider it and find the least invasive way to roll out that change (for example, by having a long deprecation cycle).

In order to achieve the release goal for Swift 3, each of the following are considered important in terms of getting the basics right for future releases:

  • API design guideline
  • Automatic application of naming guidelines to imported Objective-C APIs
  • Adoption of naming guidelines in key APIs
  • Swiftification of imported Objective-C APIs
  • Focusing and refining the language
  • Improvements to tooling quality

You can learn more about each of these areas on the Swift Evolution repository page as well as see the complete list of implemented proposals, accepted but not yet implemented proposals, and rejected or withdrawn proposals.

Summary

In this chapter we discussed Apple's goals for Swift 3 and the importance of the community's engagement and involvement to the language's development. I also showed you where to find the source of official information about new and current development on the language. Last, we learned how the community can contribute to the development process of Swift as a language. In Chapter 2, Discovering New Territories – Linux at Last! We go over developing Swift on Linux.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • 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

Description

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.

Who is this book 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

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 06, 2016
Length: 142 pages
Edition : 1st
Language : English
ISBN-13 : 9781786469632
Vendor :
Apple
Category :
Languages :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Oct 06, 2016
Length: 142 pages
Edition : 1st
Language : English
ISBN-13 : 9781786469632
Vendor :
Apple
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just S$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just S$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total S$ 178.97
Mastering macOS Programming
S$66.99
Swift 4 Programming Cookbook
S$66.99
Swift 3 New Features
S$44.99
Total S$ 178.97 Stars icon
Banner background image

Table of Contents

10 Chapters
1. What Were They Thinking? Chevron down icon Chevron up icon
2. Discovering New Territories – Linux at Last! Chevron down icon Chevron up icon
3. Migrating to Swift 3 to Be More Swifty Chevron down icon Chevron up icon
4. Changes to Swifts Core Will Have You Asking for More Chevron down icon Chevron up icon
5. Function and Operator Changes – New Ways to Get Things Done Chevron down icon Chevron up icon
6. Extra, Extra Collection and Closure Changes That Rock! Chevron down icon Chevron up icon
7. Hold onto Your Chair; Advanced Type Changes Are Here! Chevron down icon Chevron up icon
8. Oh Goodness! Look Whats New in the Foundation Framework Chevron down icon Chevron up icon
9. Improving Your Code with Xcode Server and LLDB Debugging Chevron down icon Chevron up icon
10. Exploring Swift on the Server Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Kevin Buckley Mar 12, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.