REVIEW YOUR LEARNING

TEST YOURSELF


Paul Hudson      @twostraws

As you progress learning Swift it's a good idea to stop and double-check everything is sinking in, so here you can find questions and answers about a range of Swift language and iOS development topics. Don't worry if you make mistakes: your answers aren't stored online, and you can always revisit topics as needed.

Swift in Sixty Seconds

Simple Types
Variables
Strings and integers
Multi-line strings
Doubles and booleans
String interpolation
Constants
Type annotations
Simple types: Summary
Complex Types
Arrays
Sets
Tuples
Arrays vs sets vs tuples
Dictionaries
Dictionary default values
Creating empty collections
Enumerations
Enum associated values
Enum raw values
Complex types: Summary
Operators and conditions
Arithmetic operators
Operator overloading
Compound assignment operators
Comparison operators
Conditions
Combining conditions
The ternary operator
Switch statements
Range operators
Operators and conditions: Summary
Looping
For loops
While loops
Repeat loops
Exiting loops
Exiting multiple loops
Skipping items
Infinite loops
Looping: Summary
Functions
Writing functions
Accepting parameters
Returning values
Parameter labels
Omitting parameter labels
Default parameters
Variadic functions
Writing throwing functions
Running throwing functions
inout parameters
Functions: Summary
Closures
Creating basic closures
Accepting parameters in a closure
Returning values from a closure
Closures as parameters
Trailing closure syntax
Using closures as parameters when they accept parameters
Using closures as parameters when they return values
Shorthand parameter names
Closures with multiple parameters
Returning closures from functions
Capturing values
Closures: Summary
Structs
Creating your own structs
Computed properties
Property observers
Methods
Mutating methods
Properties and methods of strings
Properties and methods of arrays
Initializers
Referring to the current instance
Lazy properties
Static properties and methods
Access control
Structs: Summary
Classes
Creating your own classes
Class inheritance
Overriding methods
Final classes
Copying objects
Deinitializers
Mutability
Classes: Summary
Protocols
Protocols
Protocol inheritance
Extensions
Protocol extensions
Protocol-oriented programming
Protocols and extensions: Summary
Optionals
Handling missing data
Unwrapping optionals
Unwrapping with guard
Force unwrapping
Implicitly unwrapped optionals
Nil coalescing
Optional chaining
Optional try
Failable initializers
Typecasting
Optionals: Summary

Hacking with Swift

Project 1: Storm Viewer
Project 2: Guess the Flag
Project 3: Social media
Project 4: Easy Browser
Project 5: Word Scramble
Project 6: Auto Layout
Project 7: Whitehouse Petitions
Project 8: 7 Swifty Words
Project 9: Grand Central Dispatch
Project 10: Names to Faces
Project 11: Pachinko
Project 12: UserDefaults

FAQ

Q: Where are my scores stored?

A: Your scores are stored using your web browser's local storage, so no one else can see them – they are just there so you can monitor your progress.

Q: What do I get if I complete all the reviews?

A: You get the warm glow of knowing you've mastered the fundamentals of Swift – good job!

Q: Where can I go to learn more?

A: Each of the review sections are designed to follow my Swift in Sixty Seconds and Hacking with Swift series, which are free online. If you complete all these and want to push your Swift skills further, you should read my book Pro Swift.

Q: What's stopping me from cheating?

A: I'm sure you could look up the correct answers as you go, but you're only cheating yourself – your scores aren't public.

Q: Where can I report mistakes?

A: If you spot mistakes in the questions, please either email me at paul@hackingwithswift.com or tweet me @twostraws.