Teaching App Development with Swift


Level 2, Eleven Lessons

Teach students about delegates, delegation and protocols through the creation of a programming classic. Facilitate a deeper understanding of Model-View-Controller, and demonstrate how to persist data with NSUserDefaults.

The Finished App

Familiarize yourself with the project, and demonstrate the app students will build.

Lesson 1

Discuss interface elements and user interaction. Introduce the picker view interface element.

Lesson 2

Use the UIPickerViewDataSource protocol as a vehicle for explaining Swift protocols.

Lesson 3

Use the UIPickerViewDelegate protocol to explain delegates and delegation.

Lesson 4

Leverage a mutable array of values to lead a refactoring from loops to an introduction of map.

Lesson 5

Facilitate implementing a delegate method to update a controller outlet.

Lesson 6

Analyze controller code to determine what should be extracted into a model.

Lesson 7

Introduce the concept of a "view model," and demonstrate adding custom objects that serve the view.

Lesson 8

Lead a refactoring to re-integrate the view, view model, and controller.

Lesson 9

Analyze app usability, and lead an implementation change to the interface for an improved initial state.

Lesson 10

Explain the NSUserDefaults API for storing and retrieving app data.

Lesson 11

Demonstrate loading date with the NSUserDefaults API, and resolve a subtle bug to illustrate type casting and optional binding.

The course materials only, and not any other content of this web page, are to be used pursuant to a Creative Commons license, as specified in the license information within the course materials.

Trademark Information

The Swift logo, Apple, the Apple logo and other Apple trademarks, service marks, graphics, and logos used in connection with the Swift Education project are trademarks or registered trademarks of Apple Inc. in the US and/or other countries. Other trademarks, service marks, graphics, and logos used in connection with the Swift Education project may be the trademarks of their respective owners. You are granted no right or license in any of the aforesaid trademarks, and further agree that you shall not remove, obscure, or alter any proprietary notices (including trademark and copyright notices) that may be affixed to or contained within the Service.

For further information about proper referential uses of the Swift logo, please review the “Guidelines for Using Apple Trademarks and Copyrights”.