I've mentioned a few times now that I'd like to write a book on Swift. The target audience is anyone learning Swift, whether they already know how to program already or not, and whether they're learning because they'd like to go onto making iOS apps or OS X apps.
I've read Apple's The Swift Programming Language cover to cover, and I've gone back over some great books on learning other programming languages, including Learn C The Hard Way, Learn Python the Hard Way, How to Design Programs (a book on Lisp/Scheme/Racket), and Obj-C Programming, from Big Nerd Ranch.
I've also spent several hours playing with Swift in Xcode 6's playground.
So, I've been thinking about how I should organize topics within the book, and I've come up with this list of chapter subjects so far (anything after "For Completeness:" on a line is something that seems like you could easily get away with not knowing, but I include them just for the sake of covering everything about Swift):
00 - Setup and explaining the book
01 - Arithmetic and Comments
02 - For Completeness: Binary literals, hexadecimal literals, bitwise operators
03 - if-else
04 - Strings and String Interpolation
05 - let and Naming (note that you can easily cover the above topics without any lets or vars).
06 - Booleans, Logical Operators, and Ternaries
07 - Number Types, Type Annotation, and var (intentionally covered late, in the hope that learners get used to using constants and only use vars on things that actually need to be vars)
08 - Basic Switches and Cases, For Completeness: fall though, break, and if-else if-else (if-else if-else shouldn't be necessary with the improved Switches and Cases in Swift).
09 - For-In Loops with Ranges, break, continue, and labels.
10 - For Completeness: for-condition-increment loops, while loops, do-while loops, and semicolons (All unnecessary relics from past languages).
11 - Arrays
12 - Dictionaries
13 - Functions and Scope
14 - For Completeness: Custom Operators (Unnecessary, and probably a bad idea).
15 - Optionals and Tuples
16 - Closures
17 - Using Methods (as opposed to making them)
18 - Structures and Stored Properties
19 - Optional Chaining (not really possible to cover before properties)
20 - Computed Properties and Lazy Properties
21 - Property Observers
22 - Writing Methods, For Completeness: self
23 - Mutating Methods
24 - Type Properties and Methods (static)
25 - Subscripts
26 - Generics
27 - Extensions
28 - Enums and Advanced Switches and Cases
29 - Classes, Identity Checks, and Automatic Reference Counting
30 - Initializers and Deinitilaizers
31 - Inheritance, Subclassing, Override, and Final
32 - Type Casting and Checking
This is a major point in the book, where I stop covering just Swift the Language and its Standard Library, and actually bring in some Cocoa Touch:
33 - Protocols and UITableView
34 - Drawing
35 - Animation
Up until this point, everything could be covered in Playgrounds, but at this point I want to swap to making interactive applications for iOS and OS X.
I'm not sure how to organize the topics, or what I specifically need to cover, but I had the following in mind:
- Debugging in Xcode with breakpoints and by inspecting variables.
- Storyboards
- XIBs
- Git
- Unit Testing
- Core Data (?)
Any suggestions for other things that I need to cover... maybe suggestions for rearranging what I want to cover?
I've read Apple's The Swift Programming Language cover to cover, and I've gone back over some great books on learning other programming languages, including Learn C The Hard Way, Learn Python the Hard Way, How to Design Programs (a book on Lisp/Scheme/Racket), and Obj-C Programming, from Big Nerd Ranch.
I've also spent several hours playing with Swift in Xcode 6's playground.
So, I've been thinking about how I should organize topics within the book, and I've come up with this list of chapter subjects so far (anything after "For Completeness:" on a line is something that seems like you could easily get away with not knowing, but I include them just for the sake of covering everything about Swift):
00 - Setup and explaining the book
01 - Arithmetic and Comments
02 - For Completeness: Binary literals, hexadecimal literals, bitwise operators
03 - if-else
04 - Strings and String Interpolation
05 - let and Naming (note that you can easily cover the above topics without any lets or vars).
06 - Booleans, Logical Operators, and Ternaries
07 - Number Types, Type Annotation, and var (intentionally covered late, in the hope that learners get used to using constants and only use vars on things that actually need to be vars)
08 - Basic Switches and Cases, For Completeness: fall though, break, and if-else if-else (if-else if-else shouldn't be necessary with the improved Switches and Cases in Swift).
09 - For-In Loops with Ranges, break, continue, and labels.
10 - For Completeness: for-condition-increment loops, while loops, do-while loops, and semicolons (All unnecessary relics from past languages).
11 - Arrays
12 - Dictionaries
13 - Functions and Scope
14 - For Completeness: Custom Operators (Unnecessary, and probably a bad idea).
15 - Optionals and Tuples
16 - Closures
17 - Using Methods (as opposed to making them)
18 - Structures and Stored Properties
19 - Optional Chaining (not really possible to cover before properties)
20 - Computed Properties and Lazy Properties
21 - Property Observers
22 - Writing Methods, For Completeness: self
23 - Mutating Methods
24 - Type Properties and Methods (static)
25 - Subscripts
26 - Generics
27 - Extensions
28 - Enums and Advanced Switches and Cases
29 - Classes, Identity Checks, and Automatic Reference Counting
30 - Initializers and Deinitilaizers
31 - Inheritance, Subclassing, Override, and Final
32 - Type Casting and Checking
This is a major point in the book, where I stop covering just Swift the Language and its Standard Library, and actually bring in some Cocoa Touch:
33 - Protocols and UITableView
34 - Drawing
35 - Animation
Up until this point, everything could be covered in Playgrounds, but at this point I want to swap to making interactive applications for iOS and OS X.
I'm not sure how to organize the topics, or what I specifically need to cover, but I had the following in mind:
- Debugging in Xcode with breakpoints and by inspecting variables.
- Storyboards
- XIBs
- Git
- Unit Testing
- Core Data (?)
Any suggestions for other things that I need to cover... maybe suggestions for rearranging what I want to cover?