Module Outline

Use the following resources and work with your mentor to master the objectives for this module. Practice by completing the Mini-Project, Project, and Challenges.

Objectives

Required Preclass Resources

Video Challenges

  • Random Assignment

    Update the 3 Card Monte game to randomize the Queen.

  • Reminder

    Build a view with a text field and a 'Schedule Reminder' button. When the user enters text and presses the button, schedule a reminder using that text to fire in 10 seconds. Remember to request permissions and address receiving local notifications while the app is active.

Stretch Problem

    Protocols and Protocol Extensions

    1. Create a protocol Vehicle that requires a variable for speed as a Double, a variable for isMoving as a Bool, and a func startMoving() and func stopMoving().
    2. Create two separate classes that conform to the Vehicle protocol (i.e. class LawnMower and class Truck). Your start and stop functions should simply check for whether or not the isMoving property is true or false, switch it to the opposite, and then print whether or not it is moving.
    3. Create one instance of each of your two classes, and call your start and stop functions on them to be sure they work.
    4. Notice that you have to write the same function in two distinct classes. Create an extension on your vehicle protocol and implement the two functions there. Now delete the two functions from your two classes. Notice that you do not have an error and that the functions still work.

    ♦ Black Diamond

    1. Create a protocol Racer that inherits from your first protocol and adds a func race() -> Double.
    2. Implement your race function in a protocol extension. It should return the time it takes for the vehicle the function was called on to travel 1000 meters.
    3. Create two more classes that conform to Racer or make your existing vehicles conform to Racer. Create another function outside of your classes that will take in two Racer objects and return the winner.
  • Solution

Guided Project

    PowerNapTimerWithAlerts

    PowerNapTimer is designed to have students practice implementing timer logic, NSNotifications, UIAlertController, and UILocalNotifications.

Project

  • Alarm Part Two

    Students will build a simple alarm app to practice intermediate table view features, protocols, the delegate pattern, NSCoding, UILocalNotifications, and UIAlertControllers.

    ReadMe

Mastery Review

Module 12 - Alert Controllers, Local Alerts
  • Expand all
  • Collapse all
  • Protocols and Protocol Extensions stretch problem
  • Challenges
    • Random Assignment objective challenge
    • Reminder objective challenge
  • PowerNapTimerWithAlerts guided project