CS 466 - Reading: Swift part 1
Due: 2017-03-02 12:00p
Objectives
For this reading you are going to start getting an introduction to the Swift language. The basics of the language will feel familiar. You should have enough languages under your belts to not be tripped up by conditionals, loops and variables. However, there are some tricky differences to look out for (let
and var
will certainly be an issue for those of you who are, like me, switching back and forth between JavaScript…)
The reading will come from The Swift Programming Language. It is available at that link as a website, or as a eBook from the iBooks store. Just make sure that you are reading the Swift 3 version of the book.
Start with the Swift Tour. This will give you the basics. I strongly suggest following the directions and downloading the playground.
Then please read the next few chapters. For each chapter I've broken down the sections by how much attention you should pay to them. Use the playground to experiment as you read. This looks like a lot, but some sections are quite short, and others you only need to skim. However, don't skimp on this reading – this will be important very shortly.
The Basics
Section |
Read closely |
Read |
Skim |
Constants and Variables |
|
X |
|
Comments |
|
|
X |
Semicolons |
|
|
X |
Integers |
|
|
X |
Floating-point numbers |
|
|
X |
Type Safety and Type Inference |
X |
|
|
Numeric Literals |
|
|
|
Numeric Type Conversion |
|
|
|
Type Aliases |
|
|
|
Booleans |
|
|
X |
Tuples |
|
|
X |
Optionals |
X |
|
|
Error handling |
|
|
X |
Assertions |
|
|
|
Basic Operators
Section |
Read closely |
Read |
Skim |
Terminology |
|
|
X |
Assignment Operator |
|
|
X |
Arithmetic operators |
|
|
X |
Compound Assignment Operators |
|
|
X |
Comparison Operators |
|
|
X |
Ternary Conditional Operator |
|
|
X |
Nil-Coalescing Operator |
|
X |
|
Range Operators |
|
X |
|
Logical Operators |
|
|
X |
Strings and Characters
Section |
Read closely |
Read |
Skim |
String Literals |
|
|
X |
Initializing an Empty String |
|
|
X |
String Mutability |
|
|
X |
Strings Are Value Types |
X |
|
|
Working with Characters |
|
X |
|
Concatenating Strings and Characters |
|
|
X |
String Interpolation |
X |
|
|
Unicode |
|
|
|
Counting Characters |
X |
|
|
Accessing and Modifying a String |
|
|
X |
Comparing Strings |
|
|
X |
Unicode Representations of Strings |
|
|
|
Collection Types
Section |
Read closely |
Read |
Skim |
|
Mutability of Collections |
|
X |
|
|
Arrays |
|
X |
|
|
Sets |
|
|
X |
|
Performing Set Operations |
|
|
X |
|
Dictionaries |
|
X |
|
|
Control Flow
Section |
Read closely |
Read |
Skim |
For-in loops |
|
X |
|
While loops |
|
|
X |
Conditional statements |
|
|
X |
Control Transfer Statements |
|
|
X |
Early Exit |
|
X |
|
Checking API Availability |
|
|
|
Functions
Section |
Read closely |
Read |
Skim |
Defining and Calling Functions |
X |
|
|
Function Parameters and Return Values |
X |
|
|
Function Argument Labels and Parameter Names |
X |
|
|
Function Types |
X |
|
|
Nested Functions |
|
|
X |
Closures
Section |
Read closely |
Read |
Skim |
Closure Expressions |
X |
|
|
Trailing Closures |
X |
|
|
Capturing Values |
|
|
X |
Closures are a Reference Type |
|
|
|
Escaping Closures |
|
|
|
Autoclosures |
|
|
|
Enumerations
Section |
Read closely |
Read |
Skim |
Enumeration Syntax |
X |
|
|
Matching Enumeration Values with a Switch Statement |
|
X |
|
Associated Values |
X |
|
|
Raw Values |
|
|
X |
Recursive Enumerations |
|
|
|