Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Mastering Swift 3
Mastering Swift 3

Mastering Swift 3: Build incredible apps for iOS and OS X

eBook
zł59.99 zł158.99
Paperback
zł197.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

Mastering Swift 3

Chapter 1. Taking the First Steps with Swift

Ever since I was 12 years old and wrote my first program in the BASIC programming language, programming has been a passion for me. Even as programming became my career, it always remained more of a passion than a job, but over the past few years, that passion waned. I was unsure why I was losing that passion. I attempted to recapture it with some of my side projects, but nothing really brought back the excitement that I used to have. Then, something wonderful happened! Apple announced Swift. Swift is such an exciting and progressive language that it has brought a lot of that passion back and made programming fun for me again.

In this chapter, you will learn:

  • What Swift is?
  • What are some of the features of Swift?
  • What Playgrounds are?
  • How to use Playgrounds?
  • What the basic syntaxes of the Swift language are?

What is Swift?

Swift is Apple's new programming language, introduced at the Worldwide Developers Conference (WWDC) in 2014 alongside the integrated development environment Xcode 6 and iOS 8. Swift was arguably the most significant announcement at WWDC 2014, and very few people, including Apple insiders, were aware of the project's existence prior to it being announced.

It was amazing, even by Apple's standards, that they were able to keep Swift a secret for as long as they did and that no one suspected they were going to announce a new development language. At WWDC 2015, Apple made another big splash when they announced Xcode 7 and Swift 2. Swift 2 was a major enhancement to the Swift language. During that conference, Chris Lattner said that a lot of the enhancements were based on the direct feedback that Apple received from the developer community.

On December of 2015, Apple officially released Swift as an open source project, with the swift.org site dedicated to the open source Swift community. The Swift repository is located on Apple's GitHub page (http://github.com/apple). The Swift evolution repository (https://github.com/apple/swift-evolution) tracks the evolution of Swift by documenting the proposed changes for Swift. You can also find a list of which proposals were accepted and which were rejected in the evolution repository. If you are interested in understanding where Swift is heading, you should check out this repository. It is interesting to note that Swift 3 contains several enhancements that were proposed by the community.

Swift 3 is a major enhancement to the Swift language that is NOT source compatible with previous releases of the Swift language. It contains fundamental changes to the language itself and to the Swift standard library. One of the main goals of Swift 3 is to be source compatible across all platforms, so the code that we write for the one platform will be compatible with all other platforms. This means that the code we develop for Mac OS will work on Linux, although certain frameworks, such as UIKit, may not be compatible across platforms.

The development of Swift was started in 2010 by Chris Lattner. He implemented much of the basic language structure, with only a few people being aware of its existence. It wasn't until late 2011 that other developers began to really contribute to Swift and in July of 2013, it became a major focus of the Apple Developer Tools group.

Chris Lattner started working at Apple in the summer of 2005. He has held several positions in the Developer Tools group and is currently the director and architect of that group. On his home page (http://www.nondot.org/sabre/), he notes that Xcode's Playgrounds (you can read more on Playgrounds a little later in this chapter) became a personal passion of his because it makes programming more interactive and approachable. We will be using Playgrounds a lot in this book as a test and experimentation platform. Starting with iOS 10, we will be able to use Swift Playgrounds on the iPad.

Note

To me, being able to use Swift Playgrounds on the iPad is very exciting because it will make it easier for people getting started with programming to learn the Swift language. I am really looking forward to showing my daughters how to use Playgrounds on their iPads.

There are a lot of similarities between Swift and Objective-C. Swift adopts the readability of Objective-C's named parameters and dynamic object model. When we refer to Swift as having a dynamic object model, we are referring to the ability of types to change at runtime. This includes adding new (custom) types and changing/extending the existing types.

While there are a lot of similarities between Swift and Objective-C, there are significant differences between them as well. Swift's syntax and formatting are a lot closer to Python than Objective-C, but Apple did keep the curly braces. I know Python people would disagree with me, and that is all right because we all have different opinions, but I like the curly braces. Swift actually makes the curly braces required for control statements, such as if and while, which eliminates bugs, such as goto fail in Apple's SSL library.

Swift was also built to be fast. At WWDC 2014, Apple showed a number of benchmarks, which proved that Swift significantly outperformed Objective-C. Swift uses the LLVM compiler, which is included with Xcode 7 to transform Swift code into highly optimized native code that is tuned to get the most out of Apple's modern hardware.

Swift features

When Apple said that Swift is Objective-C without the C, they were really only telling us half of the story. Objective-C is a superset of C and provides object-oriented capabilities and a dynamic runtime to the C language. This meant that with Objective-C, Apple needed to maintain compatibility with C, which limited the enhancements it could make to the Objective-C language. As an example, Apple could not change how the switch statement functioned and still maintain the C compatibility.

Since Swift does not need to maintain the same C compatibility as Objective-C, Apple was free to add any features/enhancements to the language. This allowed Apple to include the best features from many of today's most popular and modern languages, such as Objective-C, Python, Java, Ruby, C#, Haskell, and many others.

The following chart shows a list of some of the most exciting enhancements that Swift includes:

Swift feature

Description

Type inference

Swift can automatically deduce the type of the variable or constant based on the initial value.

Generics

Generics allow us to write code once to perform identical tasks for different types of objects while still maintaining type safety.

Collection mutability

Swift does not have separate objects for mutable or non-mutable containers. Instead, you define mutability by defining the container as a constant or variable.

Closure syntax

Closures are self-contained blocks of functionality that can be passed around and used in our code.

Optionals

Optionals define a variable that might not have a value.

Switch statement

The switch statement has been drastically improved with features such as pattern matching, guard conditions, and no automatic fall-through. This is one of my favorite improvements.

Multiple return types

Functions can have multiple return types using tuples.

Operator overloading

Classes can provide their own implementation of the existing operators.

Enumerations with Associated values

In Swift, we can do a lot more than just defining a group of related values with enumerations.

There is one feature that I did not mention in the preceding chart because it is technically not a feature of Swift; it is a feature of Xcode and the compiler. This feature is Mix and match. Mix and match allow us to create applications that contain both Objective-C and Swift files. This allows us to systematically update our current Objective-C applications with Swift classes and also use Objective-C libraries/frameworks in our Swift applications.

Before we begin our journey into the wonderful world of Swift development, let's take a detour and visit a place that I have loved ever since I was a kid—the playground.

Playgrounds

When I was a kid, the best part of the school day was going to the playground. It really did not matter what we were playing; as long as we were on the playground, I knew it would be fun. When Apple introduced Playgrounds as part of Xcode 6, I was excited just by the name, but I wondered if Apple would be able to make its Playgrounds as fun as the playgrounds of my youth. While Apple's Playgrounds might not be as fun as playing kickball when I was nine years old, it definitely brings a lot of fun back to experimenting and playing with code.

Getting started with Playgrounds

Playgrounds are interactive work environments that let us write code and see the results immediately as changes are made to the code. This means that Playgrounds are a great way to learn and experiment with Swift.

Playgrounds also make it incredibly easy to try out the new APIs, prototype new algorithms, and demonstrate how the code works. We will be using Playgrounds throughout this book to show how our sample code works. Therefore, before we really get into Swift development, let's spend some time learning about and getting comfortable with Playgrounds.

Do not worry if the Swift code does not make a lot of sense right now; as we go through the book, this code will begin to make sense. We are simply trying to get a feel of Playgrounds right now.

A Playground can have several sections, but the three that we will be using extensively in this book are as follows:

  • Coding Area: This is where you enter your Swift code.
  • Results Sidebar: This is where the results of your code are shown. Each time you type in a new line of code, the results are re-evaluated and the results' sidebar is updated with the new results.
  • Debug Area: This area displays the output of the code, and it can be very useful for debugging.

The following screenshot shows how the sections are arranged in a Playground:

Getting started with Playgrounds

Let's start a new Playground. The first thing we need to do is start Xcode. Once Xcode has started, we can select the Get started with a playground option, as shown in the following screenshot:

Getting started with Playgrounds

Alternatively, we can navigate to the Playground by going to File | New from the top menu bar, as shown in the following screenshot:

Getting started with Playgrounds

Next, we should see a screen similar to the following screenshot; it lets us name our Playground and select whether the Playground is an iOS or OS X Playground. For most of the examples in this chapter, it is safe to assume that you can select either iOS or OS X unless otherwise noted:

Getting started with Playgrounds

Finally, we are asked for the location to save our Playground. After we select the location, the Playground will open up and look similar to the following screenshot:

Getting started with Playgrounds

In the preceding screenshot, we can see that the coding area of the Playground looks similar to the coding area for a Xcode project. What is different here is the sidebar on the right-hand side. This sidebar is where the results of our code are shown. The code in the previous screenshot imports the iOS UIKit framework and sets a variable named str to the Hello, playground string. You can see the content of the str string in the sidebar to the right of the code. We also create a for loop that prints the numbers 0 to 5 to the console.

By default, a new Playground does not open the debug area. You can open it manually by pressing the shift + command + Y keys together. Later in the chapter, we will see why the debug area is so useful.

iOS and OS X Playgrounds

When you start a new iOS Playground, the Playground imports UIKit (Cocoa Touch). This gives us access to the UIKit framework, which provides the core infrastructure for iOS applications. When we start a new OS X Playground, the Playground imports Cocoa. This gives us access to the OS X Cocoa framework.

What the last paragraph means is if we want to experiment with the specific features of either UIKit or Cocoa, we will need to open the correct Playground. As an example, if we have an iOS Playground open and we want to create an object that represents a color, we would use a UIColor object. If we had an OS X playground open, we would use an NSColor object to represent a color.

Showing images in a Playground

Playgrounds are great at showing the results of code as text in the results sidebar, but they can also do a lot more than that. We can display other items, such as images and graphs. Let's take a look at how we would show an image in a Playground. The first thing we need to do is load the image into the resource directory of our Playground.

The following steps show how to load an image into the resource directory:

  1. Let's begin by showing the Project Navigator sidebar. To do this, in the top menu bar, navigate to View | Navigators | Show Project Navigator or use the command + 1 keyboard shortcut. The Project Navigator looks similar to this:

    Showing images in a Playground

  2. Once we have the Project Navigator open, we can drag the image into the Resources folder so that we can access it from our code. Once we drag the image file over it and drop it, it will appear in the Resources folder, as shown in the following screenshot:

    Showing images in a Playground

  3. Now we can access the image that is in our Resources folder within our code. The following screenshot shows how we can do this. The actual code that we use to access the image is not as important at this time as knowing how to access resources within a playground:

    Showing images in a Playground

  4. To view the image, we need to hover our cursor in the results sidebar over the section that shows the width and height of the image. In our example, the width and height section shows w 256 h 256. Once we hover the mouse pointer over the width and height, we should see two symbols, as shown in the following screenshot:

    Showing images in a Playground

  5. We can press either of the symbols to show the image. The one that is shaped like a circle with a plus sign in it will display the image within the playground's code section, while the one that looks like an eye will pop the image up outside the playground. The following screenshot shows what it shows if we press the circle with a plus sign in it:

    Showing images in a Playground

Having the ability to create and display graphs can be very useful when we want to see the progression of our code. Let's look at how we can create and display graphs in a Playground.

Creating and displaying graphs in Playgrounds

Creating and displaying graphs is really useful when we are prototyping new algorithms because it allows us to see the value of the variable throughout the course of the calculations. To see how graphing works, take a look at the following Playground:

Creating and displaying graphs in Playgrounds

In this playground, we set the variable j to 1. Next, we create a for loop that assigns numbers 1 through 5 to the variable i. At each step in the for loop, we set the value of the variable j to the current value of j multiplied by i. The graph shows the values of the variable j at each step of the for loop. We will be covering for loops in detail later in this book.

To bring up the graph, click on the symbol that is shaped like a circle with a dot in it. We can then move the timeline slider to see the values of variable j at each step of the for loop. The following playground shows what the graph will look like:

Creating and displaying graphs in Playgrounds

What Playgrounds are not

There is a lot more that we can do with Playgrounds, and we have only scratched the surface in our quick introduction here. Before we leave this brief introduction, let's take a look at what Playgrounds are not so that we can understand when not to use Playgrounds:

  • Playgrounds should not be used for performance testing: The performance you see from any code that is run in a Playground is not representative of how fast the code will run when it is in your projects
  • Playgrounds do not support user interaction: Users cannot interact with code that is run in a Playground
  • Playgrounds do not support on-device execution: You cannot run code on an external device from a Playground

Swift language syntax

If you are an Objective-C developer and you are not familiar with modern languages such as Python or Ruby, the code in the previous screenshots may have looked pretty strange. The Swift language syntax is a huge departure from Objective-C, which was based largely on Smalltalk and C.

The Swift language uses modern concepts and syntax to create very concise and readable code. There is also a heavy emphasis on eliminating common programming mistakes. Before we get into the Swift language itself, let's take a look at some of the basic syntax of it.

Comments

Writing comments in Swift code is a little different from writing comments in Objective-C code. We can still use the double slash // for single-line comments and /* and */ for multiline comments. However, if we want to use the comments to also document our code, we need to use the triple slash, ///. To document our code, we use fields that Xcode recognizes. These fields are as follows:

  • Parameter: When we start a line with - parameter {param name}:, Xcode recognizes this as the description for a parameter
  • Returns: When we start a line with - returns:, Xcode recognizes this as the description for the return value
  • Throws: When we start a line with - throws:, Xcode recognizes this as the description for the errors that this method may throw

The following Playground shows examples of both single-line and multiline comments and how to use the comment fields:

Comments

To write good comments, I recommend using single-line comments within a function to give quick one-line explanations of your code. We will then use multiline comments outside of functions and classes to explain what the function and class does. The preceding Playground shows a good use of comments. By using proper documentation, as we did in the preceding screenshot, we can use the documentation feature within Xcode. If we hold down the option key and then click on the function name anywhere in our code, Xcode will display a popup with the description of the function.

This next screenshot shows what that popup  may look like:

Comments

This screenshot shows the documentation feature of Xcode if we hold down the option key and then click on the myAdd() method. We can see that the documentation contains six fields. These fields are as follows:

  • Declaration: This is the function's declaration
  • Description: This is the description of the function as it appears in the comments
  • Parameters: The parameter descriptions are prefixed with the - Parameters: tag in the comment section
  • Throws: The throws description is prefixed with the - throws: tag and describes what errors are thrown by the methods
  • Returns: The return description is prefixed with the - returns: tag in the comment section
  • Declared In: This is the file that the function is declared in so that we can easily find it

Semicolons

You may have probably noticed from the code samples so far that we are not using semicolons at the end of the lines. The semicolons are optional in Swift; therefore, both lines in the following Playground are valid in Swift. You can see the results of the code in the results sidebar, as shown in the following screenshot:

Semicolons

The only time semicolons are required is when we put consecutive statements on one line. For example, if we had a line such as this:

print("Hello from Swift"); return 42 

Then the semicolon between the print and return statements would be required. It is recommended that you do not put multiple statements on the same line, but if you want too, then remember the semicolon is required.

For style purposes, it is strongly recommended that you do not use semicolons in your Swift code. If you are really intent on using semicolons in your code, then be consistent and use them on every line of code; however, Swift will not warn you if you forget them. I will stress again that it is recommended that you do not use semicolons in Swift.

Parentheses

In Swift, parentheses around conditional statements are optional; for example, both if statements in the following Playground are valid. You can see the results of the code in the sidebar.

For style purposes, it is recommended that you do not include parentheses in your code unless you have multiple conditional statements on the same line. For readability purposes, it is good practice to put parentheses around individual conditional statements that are on the same line.

See the following Playground for samples:

Parentheses

Curly brackets for control statements

In Swift, unlike most other languages, the curly bracket is required after conditional or loop statements. This is one of the safety features that is built into Swift. Arguably, there have been numerous security bugs that may have been prevented if the developer would have used curly braces. These bugs could also have been prevented by other means such as unit testing and code reviews, but requiring developers to use curly braces, in my opinion, is a good security standard.

The following Playground shows you what error you get if you forget to include the curly braces:

Curly brackets for control statements

An assignment operator does not return a value

In most other languages, the following line of code is valid, but it probably is not what the developer meant to do:

if (x = 1) {} 

Tip

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

In Swift, this statement is not valid. Using an assignment operator (=) in a conditional statement (if and while) will throw an error. This is another safety feature built into Swift. It prevents the developer from forgetting the second equals sign (=) in a comparison statement. This error is shown in the following Playground:

An assignment operator does not return a value

Spaces are optional in conditional and assignment statements

For both conditional (if and while) and assignment (=) statements, the white spaces are optional. Therefore, in the following Playground, both The i block and The j block of code are valid:

Spaces are optional in conditional and assignment statements

Tip

For style purposes, I would recommend adding white spaces (such as The j block for readability purposes), but as long as you pick one style and be consistent, either style should be acceptable.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • • Discover the new features and improvements to Swift 3
  • • Get to grips with advanced design patterns and techniques to write smarter, cleaner Swift code
  • • Become a more fluent Swift developer and build powerful, impressive iOS and OS X applications.

Description

Swift is the definitive language of Apple development today. It’s a vital part of any iOS and OS X developer’s skillset, helping them to build the most impressive and popular apps on the App Store—the sort of apps that are essential to iPhone and iPad users every day. With version 3.0, the Swift team have added new features to improve the development experience—making it easier to get the results you want and customers expect. Inside, you’ll find the key features of Swift 3.0 and quickly learn how to use the newest updates to your development advantage. From Objective-C interoperability to ARC, to closures and concurrency, this advanced Swift guide will develop your expertise and make you more fluent in this vital programming language. We give you in-depth knowledge of some of the most sophisticated elements of Swift development including protocol extensions, error-handling, design patterns, and concurrency, and guide you on how to use and apply them in your own projects. You'll see how even the most challenging design patterns and programming techniques can be used to write cleaner code and to build more performant iOS and OS X applications. By the end of this book, you’ll have a handle on effective design patterns and techniques, which means you’ll soon be writing better iOS and OS X applications with a new level of sophistication and control.

Who is this book for?

This book is for developers who want to dive into the newest version of Swift. If you are a developer that learns best by looking at, and working with code, then this book is for you. A basic understanding of Apple's tools is beneficial but not mandatory.

What you will learn

  • Dive into the core components of Swift 3.0, including operators, collections, control flow, and functions
  • Create and use classes, structures, and enums
  • Understand object-oriented Swift and see how to tackle inheritance, protocols, and extensions
  • Develop a practical understanding of subscripts, optionals, and closures
  • See how to use the new protocol extension and error handling features of Swift 3.0
  • Add concurrency to your applications using Grand Central Dispatch

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 25, 2016
Length: 392 pages
Edition : 1st
Language : English
ISBN-13 : 9781786466129
Vendor :
Apple
Category :
Languages :
Tools :

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 25, 2016
Length: 392 pages
Edition : 1st
Language : English
ISBN-13 : 9781786466129
Vendor :
Apple
Category :
Languages :
Tools :

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 zł20 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 zł20 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 419.98
Mastering Swift 3
zł197.99
Learning Xcode 8
zł221.99
Total 419.98 Stars icon

Table of Contents

17 Chapters
1. Taking the First Steps with Swift Chevron down icon Chevron up icon
2. Learning About Variables, Constants, Strings, and Operators Chevron down icon Chevron up icon
3. Using Swift Collections and the Tuple Type Chevron down icon Chevron up icon
4. Control Flow and Functions Chevron down icon Chevron up icon
5. Classes and Structures Chevron down icon Chevron up icon
6. Using Protocols and Protocol Extensions Chevron down icon Chevron up icon
7. Protocol-Oriented Design Chevron down icon Chevron up icon
8. Writing Safer Code with Availability and Error Handling Chevron down icon Chevron up icon
9. Custom Subscripting Chevron down icon Chevron up icon
10. Using Optional Types Chevron down icon Chevron up icon
11. Working with Generics Chevron down icon Chevron up icon
12. Working with Closures Chevron down icon Chevron up icon
13. Using Mix and Match Chevron down icon Chevron up icon
14. Concurrency and Parallelism in Swift Chevron down icon Chevron up icon
15. Swift Formatting and Style Guide Chevron down icon Chevron up icon
16. Swifts Core Libraries Chevron down icon Chevron up icon
17. Adopting Design Patterns in Swift Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.3
(8 Ratings)
5 star 75%
4 star 0%
3 star 12.5%
2 star 0%
1 star 12.5%
Filter icon Filter
Top Reviews

Filter reviews by




j4nnis Jan 18, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I was the technical reviewer for this book. This means I had a minor role in the production of this book. But it also means that i did read earlier drafts of this book fairly thoroughly. I can't very well give a comment on typos because I did not read the final version of every chapter. So my short review:The book gives a good introduction to Swift in it’s most current iteration. It explains critical concepts of the language like optionals, generics and closures without over-complicating them. Being a book specifically on Swift 3 it points out differences between earlier version of the language and this most current one. Jon’s style of writing is easy to follow and understand.I especially liked that the book does a detour and suggest how a few common design patterns could sensibly be adopted in Swift 3. For programmers coming from other languages this can be valuable as it shows familiar functionality done with a new set of tools.Although Swift 3 does not contain any language level concurrency Mastering Swift 3 explains existing technologies to deal with asynchronous problems. This includes an introduction to Grand Central Dispatch and Operation queues.I think the book does a good job of giving the reader an intoduction to Swift and to real world programming in this language.
Amazon Verified review Amazon
Dharma Kshetri Jan 20, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
lots of real-world examples and useful resources for learning swift3. I would like to highly recommended to all of developers, who want to learn swift 3.
Amazon Verified review Amazon
JMcDivitt Jan 14, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great Resource and learning material
Amazon Verified review Amazon
Sandeep Mahajan Apr 23, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Awesome book.
Amazon Verified review Amazon
Matthew Whillock Mar 27, 2017
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Very good book, seems to cover everything in a readable style.
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.