Click to see Table of Contents
- Day 1 - First Steps in Swift
- Day 2 - Complex Types
- Day 3 - Operators and Conditions
- Day 4 - Looping
- Day 5 - Functions
- Day 6 - Closures, Part One
- Day 7 - Closures, Part Two
- Day 8 - Structs, Part One
- Day 9 - Structs, Part Two
- Day 10 - Classes
- Day 11 - Protocols And Extensions
- Day 12 - Optionals
- Day 13 - Swift Review, Day One
- Day 14 - Swift Review, Day Two
- Day 15 - Swift Review, Day Three
- Day 16 - Project 1, Part One
- Day 17 - Project 1, Part Two
- Day 18 - Project 1, Part Three
- Day 19 - Project 2, Part One
- Day 20 - Project 2, Part Two
- Day 21 - Project 2, Part Three
- Day 22 - Project 3
- Day 23 - MILESTONE: Projects 1-3
- Day 24 - Project 4, Part One
- Day 25 - Project 4, Part Two
- Day 26 - Project 4, Part Three
- Day 27 - Project 5, Part One
- Day 28 - Project 5, Part Two
- Day 29 - Project 5, Part Three
- Day 30 - Project 6, Part One
- Day 31 - Project 6, Part Two
- Day 32 - MILESTONE: Projects 4-6
- Day 33 - Project 7, Part One
- Day 34 - Project 7, Part Two
- Day 35 - Project 7, Part Three
- Day 36 - Project 8, Part One
- Day 37 - Project 8, Part Two
- Day 38 - Project 8, Part Three
- Day 39 - Project 9, Part One
- Day 40 - Project 9, Part Two
- Day 41 - MILESTONE: Projects 7-9
- Day 42 - Project 10, Part One
- Day 43 - Project 10, Part Two
- Day 44 - Project 10, Part Three
- Day 45 - Project 11, Part One
- Day 46 - Project 11, Part Two
- Day 47 - Project 11, Part Three
- Day 48 - Project 12, Part One
- Day 49 - Project 12, Part Two
- Day 50 - MILESTONE: Projects 10-12
- Day 51 - Expanding Your Horizons
- Day 52 - Project 13, Part One
- Day 53 - Project 13, Part Two
- Day 54 - Project 13, Part Three
- Day 55 - Project 14, Part One
- Day 56 - Project 14, Part Two
- Day 57 - Project 15, Part One
- Day 58 - Project 15, Part Two
- Day 59 - MILESTONE: Projects 13-15
- Day 60 - Project 16, Part One
- Day 61 - Project 16, Part Two
- Day 62 - Project 17, Part One
- Day 63 - Project 17, Part Two
- Day 64 - Project 18, Part One
- Day 65 - Project 18, Part Two
- Day 66 - MILESTONE: Projects 16-18
- Day 67 - Project 19, Part One
- Day 68 - Project 19, Part Two
Day 1 - First Steps in Swift
Variables and Constants, Strings, Integers, Doubles and Booleans, Inference and Type Annotations but setting foundations.
Day 2 - Complex Types
Arrays, Sets, Tuples, Dictionaries and Enumerations.
Day 3 - Operators and Conditions
Arithmetic Operators, Operators Overloading, Compound Assignment Operators, Comparison Operators, Conditions, Combining Conditions, The Ternary Operator, Switch Statements and Range Operators.
Day 4 - Looping
For loops, While loops, Repeat loops, Exiting loops, Exiting multiple loops, Skipping items and Infinite loops.
Day 5 - Functions
Writing functions, Accepting parameters, Returning values, Parameter labels, Omitting parameter labels, Default parameters, Variadic functions, Writing throwing functions, Running throwing functions and inout parameters.
Day 6 - Closures, Part One
Creating basic closures, Accepting parameters in a closure, Returning values from a closure, Closures as parameters and Trailing closure syntax.
Day 7 - Closures, Part Two
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 and Capturing values.
Day 8 - Structs, Part One
Creating your own structs, Computed properties, Property observers, Methods, Mutating methods, Properties and methods of strings and Properties and methods of arrays.
Day 9 - Structs, Part Two
Initializers, Referring to the current instance, Lazy properties, Static properties and methods and Access control.
Day 10 - Classes
Creating your own classes, Class inheritance, Overriding methods, Final classes, Copying objects, Deinitializers and Mutability.
Day 11 - Protocols And Extensions
Protocols, Protocol inheritance, Extensions, Protocol extensions and Protocol-oriented programming.
Day 12 - Optionals
Handling missing data, Unwrapping optionals, Unwrapping with guard, Force unwrapping, Implicitly unwrapped optionals, Nil coalescing, Optional chaining, Optional try, Failable initializers and Typecasting.
Day 13 - Swift Review, Day One
Variables and Constants, Types of Data, Operators, String Interpolation, Arrays, Dictionaries, Conditional Statements, Loops and Switch Case.
Day 14 - Swift Review, Day Two
Functions, Optionals, Optional Chaining, Enumerations, Structs and Classes.
Day 15 - Swift Review, Day Three
Properties, Static properties and methods, Access control, Polymorphism and typecasting and Closures.
Day 16 - Project 1, Part One
Setting Up, Listing Images with FileManager
and Designing Our Interface.
Day 17 - Project 1, Part Two
Building a detail screen, Loading images with UIImage
and Final tweaks: hidesBarsOnTap
, safe area margins.
Day 18 - Project 1, Part Three
Challenge
- Use Interface Builder to select the text label inside your table view cell and adjust its font size to something larger – experiment and see what looks good.
- In your main table view, show the image names in sorted order, so “nssl0033.jpg” comes before “nssl0034.jpg”.
- Rather than show image names in the detail title bar, show “Picture X of Y”, where Y is the total number of images and X is the selected picture’s position in the array. Make sure you count from 1 rather than 0.
Day 19 - Project 2, Part One
Setting up, Designing your layout and Making the basic game work: UIButton
and CALayer
.
Day 20 - Project 2, Part Two
Guess which flag: random numbers and From outlets to actions: creating an IBAction
.
Day 21 - Project 2, Part Three
Challenge
- Try showing the player’s score in the navigation bar, alongside the flag to guess.
- Keep track of how many questions have been asked, and show one final alert controller after they have answered 10. This should show their final score.
- When someone chooses the wrong flag, tell them their mistake in your alert message – something like “Wrong! That’s the flag of France,” for example.
Day 22 - Project 3
About technique projects and UIActivityViewController
explained.
Challenge
- Try adding the image name to the list of items that are shared. The activityItems parameter is an array, so you can add strings and other things freely. Note: Facebook won’t let you share text, but most other share options will.
- Go back to project 1 and add a bar button item to the main view controller that recommends the app to other people.
- Go back to project 2 and add a bar button item that shows their score when tapped.
Day 23 - MILESTONE: Projects 1-3
Challenge
The challenge is to create an app that lists various world flags in a table view.
When one of them is tapped, slide in a detail view controller that contains an image view,
showing the same flag full size. On the detail view controller,
add an action button that lets the user share the flag picture and country name using UIActivityViewController
.
Day 24 - Project 4, Part One
Setting up, Creating a simple browser with WKWebView
and Choosing a website: UIAlertController
action sheets.
Day 25 - Project 4, Part Two
Monitoring page loads: UIToolBar
and UIProgressView
and Refactoring for the win.
Day 26 - Project 4, Part Three
Challenge
- If users try to visit a URL that isn’t allowed, show an alert saying it’s blocked.
- Try making two new toolbar items with the titles Back and Forward.
You should make them use
webView.goBack
andwebView.goForward
. - For more of a challenge, try changing the initial view controller to a table view like in project 1, where users can choose their website from a list rather than just having the first in the array loaded up front.
Day 27 - Project 5, Part One
Setting up, Reading from disk: contentsOfFile
and Pick a word, any word: UIAllertController
.
Day 28 - Project 5, Part Two
Prepare for submission: lowercased()
and IndexPath
, Checking for valid answers and Or else what?
Day 29 - Project 5, Part Three
Challenge
- Disallow answers that are shorter than three letters or are just our start word.
- Refactor all the
else
statements we just added so that they call a new method calledshowErrorMessage()
. - Add a left bar button item that calls
startGame()
, so users can restart with a new word whenever they want to.
- Bonus: Fix a bug that happens when you introduce the same word with and without uppercase letters.
Day 30 - Project 6, Part One
Setting up, Advanced Auto Layout and Auto Layout in code: addConstraints()
with Visual Format Language.
Day 31 - Project 6, Part Two
Auto Layout metrics and priorities: constraints(withVisualFormat:), Auto Layout anchors and Wrap up.
Day 32 - MILESTONE: Projects 4-6
Challenge
The challenge is to create an app that lets people create a shopping list by adding items to a table view.
Day 33 - Project 7, Part One
Creating the basic UI: UITabBarController
and Parsing JSON using the Codable
protocol.
Day 34 - Project 7, Part Two
Rendering a petition: loadHTMLString
and Finishing touches: didFinishLaunchingWithOptions
.
Day 35 - Project 7, Part Three
Challenge
- Add a Credits button to the top-right corner using
UIBarButtonItem
. When this is tapped, show an alert telling users the data comes from the We The People API of the Whitehouse. - Let users filter the petitions they see. This involves creating a second array of filtered items that contains only petitions matching a string the user entered. Use a
UIAlertController
with a text field to let them enter that string. This is a tough one, so I’ve included some hints below if you get stuck.
Day 36 - Project 8, Part One
Setting up and Building a UIKit user interface programmatically.
Day 37 - Project 8, Part Two
Loading a level and adding button targets, firstIndex(of:)
and joined()
and Property observers: didSet
.
Day 38 - Project 8, Part Three
Challenge
- Draw a thin gray line around the buttons view, to make it stand out from the rest of the UI.
- If the user enters an incorrect guess, show an alert telling them they are wrong.
- Try making the game also deduct points if the player makes an incorrect guess.
Day 39 - Project 9, Part One
Beginning with Grand Central Dispatch
Day 40 - Project 9, Part Two
Challenge
- Modify project 1 so that loading the list of NSSL images from our bundle happens in the background. Code
- Modify project 8 so that loading and parsing a level takes place in the background. Code
- Modify project 7 so that your filtering code takes place in the background. Code
Day 41 - MILESTONE: Projects 7-9
Challenge
The challenge is this: make a hangman game using UIKit.
Day 42 - Project 10, Part One
Designing UICollectionView
cells and implementing data sources.
Day 43 - Project 10, Part Two
Importing photos with UIImagePickerController.
Day 44 - Project 10, Part Three
Challenge
- Add a second
UIAlertController
that gets shown when the user taps a picture, asking them whether they want to rename the person or delete them. - Use
picker.sourceType = .camera
when creating your image picker. - Modify project 1 so that it uses a collection view controller rather than a table view controller.
Day 45 - Project 11, Part One
Falling boxes with SKSpriteNode
, UITouch
and SKPhysicsBody
.
Day 46 - Project 11, Part Two
Spinning slots (SKAction
), Collision detection (SKPhysicsContactDelegate
) and Scores on the board (SKLabelNode
).
Day 47 - Project 11, Part Three
Special effects: SKEmitterNode
.
Challenge
- Try writing code to use a random ball color each time they tap the screen.
- Try to force the Y value of new balls so they are near the top of the screen.
- Give players a limit of five balls, then remove obstacle boxes when they are hit.
Day 48 - Project 12, Part One
Reading and writing basics: UserDefaults
and Fixing Project 10: NSCoding
.
Day 49 - Project 12, Part Two
Fixing Project 10: Codable
.
Challenge
- Modify project 1 so that it remembers how many times each storm image was shown. Code
- Modify project 2 so that it saves the player’s highest score, and shows a special message if their new score beat the previous high score. Code
- Modify project 5 so that it saves the current word and all the player’s entries to UserDefaults, then loads them back when the app launches. Code
Day 50 - MILESTONE: Projects 10-12
Challenge
The challenge is to put two different projects into one: I’d like you to let users take photos of things that interest them, add captions to them, then show those photos in a table view. Tapping the caption should show the picture in a new view controller, like we did with project 1. So, your finished project needs to use elements from both project 1 and project 12, which should give you ample chance to practice.
Day 51 - Expanding Your Horizons
No code today! Instead, two interesting videos about map()
, flatMap()
and filter()
.
Day 52 - Project 13, Part One
Designing the interface and importing pictures from photo library.
Day 53 - Project 13, Part Two
Applying filters: CIContext
, CIFilter
and saving to the iOS photo library.
Day 54 - Project 13, Part Three
Challenge
- Try making the Save button show an error if there was no image in the image view.
- Make the Change Filter button change its title to show the name of the currently selected filter.
- Experiment with having more than one slider, to control each of the input keys you care about. For example, you might have one for radius and one for intensity.
Day 55 - Project 14, Part One
Getting up and running: SKCropNode
and Penguin, show thyself: SKAction moveBy(x:y:duration:)
.
Day 56 - Project 14, Part Two
Whack to win: SKAction
sequences
Challenge
- Record your own voice saying "Game over!" and have it play when the game ends.
- When showing “Game Over” add an
SKLabelNode
showing their final score. - Use
SKEmitterNode
to create a smoke-like effect when penguins are hit, and a separate mud-like effect when they go into or come out of a hole.
Day 57 - Project 15, Part One
Switch, case, animate: animate(withDuration:)
and Transform: CGAffineTransform
Day 58 - Project 15, Part Two
Challenge
- Go back to project 8 and make the letter group buttons fade out when they are tapped.
We were using the
isHidden
property, but you'll need to switch toalpha
becauseisHidden
is eithertrue
orfalse
, it has no animatable values between. Code - Go back to project 13 and make the image view fade in when a new picture is chosen.
To make this work, set the
alpha
to 0 first. Code - Go back to project 2 and make the flags scale down with a little bounce when pressed. Code
Day 59 - MILESTONE: Projects 13-15
Challenge
Your challenge is to make an app that contains facts about countries: show a list of country names in a table view, then when one is tapped bring in a new screen that contains its capital city, size, population, currency, and any other facts that interest you. The type of facts you include is down to you – Wikipedia has a huge selection to choose from.
Day 60 - Project 16, Part One
Setting up, Up and running with MapKit
and Annotations and accessory views: MKPinAnnotationView
Day 61 - Project 16, Part Two
Challenge
- Try typecasting the return value from
dequeueReusableAnnotationView()
so that it's anMKPinAnnotationView
. Once that’s done, change thepinTintColor
property to your favoriteUIColor
. - Add a
UIAlertController
that lets users specify how they want to view the map. There's amapType
property that draws the maps in different ways. For example,.satellite
gives a satellite view of the terrain. - Modify the callout button so that pressing it shows a new view controller with a web view, taking users to the Wikipedia entry for that city.
Day 62 - Project 17, Part One
Setting up, Space: the final frontier, Bring on the enemies: linearDamping
, angularDamping
and Making contact: didBegin()
Day 63 - Project 17, Part Two
Challenge
- Stop the player from cheating by lifting their finger and tapping elsewhere
– try implementing
touchesEnded()
to make it work. - Make the timer start at one second, but then after 20 enemies have been made
subtract 0.1 seconds from it so it’s triggered every 0.9 seconds. After making 20 more,
subtract another 0.1, and so on. Note: you should call
invalidate()
ongameTimer
before giving it a new value, otherwise you end up with multiple timers. - Stop creating space debris after the player has died.
Day 64 - Project 18, Part One
Setting up, Basic Swift debugging using print()
, Debugging with assert()
, Debugging with breakpoints and View debugging
Day 65 - Project 18, Part Two
Challenge
- Temporarily try adding an exception breakpoint to project 1,
then changing the call to
instantiateViewController()
so that it uses the storyboard identifier “Bad” – this will fail, but your exception breakpoint should catch it. Code - In project 1, add a call to
assert()
in theviewDidLoad()
method of DetailViewController.swift, checking that selectedImage always has a value. Code - Go back to project 5, and try adding a conditional breakpoint to the
start of the
submit()
method that pauses only if the user submits a word with six or more letters. Code
Review: Debug like a Pro
Day 66 - MILESTONE: Projects 16-18
Challenge
Make a shooting gallery game using SpriteKit: create three rows on the screen, then have targets slide across from one side to the other. If the user taps a target, make it fade out and award them points.
Some key points:
- Make some targets big and slow, and others small and fast. The small targets should be worth more points.
- Add “bad” targets – things that cost the user points if they get shot accidentally.
- Make the top and bottom rows move left to right, but the middle row move right to left.
- Add a timer that ticks down from 60 seconds. When it hits zero, show a Game Over message.
- Try going to https://openclipart.org/ to see what free artwork you can find.
- Give the user six bullets per clip. Make them tap a different part of the screen to reload.
Day 67 - Project 19, Part One
Setting up, Making a shell app, Adding an extension: NSExtensionItem
and What do you want to get?
Day 68 - Project 19, Part Two
- Establishing communication.
- Editing multiline text with
UITextView
. - Fixing the keyboard:
NotificationCenter