FancyLight GitHub Repository
I end every school year with my junior students (US 11th grade) building the Light app at the end of Unit 1 in the Develop in Swift Fundamentals course. Traditionally, my students enjoy building the app, but it is not nearly as engaging as the Rock Paper Scissors app or the ColorMix apps that they would have built earlier in the school year in the Develop in Swift Explorations course. This is not to say that the Light app Guided project is not a good project. It is. It provides some useful tricks such as refactoring some code to put it into its own method because app UI changes should not live inside of an action like a button. However, I have mentioned every year that the “Fancy” flashlight apps on the original iPhone had more than one from which you could choose. Finally, this year, 2024 I built that functionality with my students into the Light app Guided project.
I mostly followed the lesson plan and lesson directions in the Develop in Swift Fundamentals Teacher Guide and the Develop in Swift Fundamentals Student books. The lone exception is that I still start by having the students code the state of the lightOn variable with this code:
lightOn = !lightOn
so that I can reinforce the logical not operator (!) and what it does to change the value of the property to it’s opposite value by negating the value such as switching from “On” to “Off”. However, we do a few steps later implement the
lightOn.toggle()
method so that I can stress that if we can use a platform's built-in methods and APIs then we should absolutely do that because they will probably make our software more performant than any custom method we could build, plus it is easier 😀. Win, win.
We added nine items to our original project in order to add swipe for more color functionality to our flashlight app:
counterAssignsColor()
function.counterAssignsColor()
method.counterAssignsColor()
method in the UISwipeGetureRecognizer
action.
Enhancing the Light app project by incorporating custom color options not only boosts student engagement but also reinforces essential programming concepts like refactoring and utilizing built-in platform methods. While this enhanced project may not lead to chart-topping app downloads, every skill acquired and concept grasped contributes significantly to students' understanding of iOS app development and computer science. This enriched learning experience ultimately better prepares them for assessments like the Certiport Swift Certified User exam, fostering their growth and future success in the field. You can find the FancyLight GitHub repository here.