Swift Playgrounds for iOS and Mac offer not just a new way to teach coding with fun puzzles and beautiful graphics, they offer us a completely new approach to teaching coding. Most courses I have seen (including my own) start with some kind of introduction to variables and constants. There has to be a way to assign a value to something so that we can demonstrate how to take a value and perform some kind of operation or action with it. While this approach can be appropriate for older students who can handle abstract thinking (think students have are taking or have taken algebra), it would most likely be confusing to most younger students who are still in the concrete thinking phase of development. I firmly believe that Swift is the language that we should be teaching (see "Why Teach Swift?") and the best Swift curriculum (as I see it) is:
- The Swift Playgrounds app for iPad with Learn to Code 1 & 2 and Learn to Code 3 books for teachers
- App Development with Swift - Teacher Student
- Teaching App Development with Swift
These 3 courses provide students and teachers with a path to learning Swift that can start in late elementary school and progress through high school. *
Start Coding in Swift without Actually Typing Code
One of the biggest differences to change how we teach coding, I believe, is the touch interface of iPad. The touch interface is a UI that most students are quite comfortable with since the iPhone is about the same age or older than many of them. Consequently, most students have grown up tapping, swiping, and flicking on their parents' iPhones (or other devices). It is the touch interface of iPad that is inviting and draws the student into the lesson like it is a personal experience. This is not a student behavior I was expecting to see, but I have seen it in my own classroom with the teenagers I teach. They get deeply involved in the adventures and puzzles they and their character of choice (Byte, Hopper, or Blue) are presented. The touch interface-based coding allows students to learn the function and purpose of the code in each lesson without being overly focused on having to input (type) Swift syntax that can be difficult for a young or new coding learner. Thus, they get the advantage of working with actual Swift code without the rigor of typing code and the stress that is associated with learning to code.
Students using the Swift Playgrounds app for iPad code in a dynamic and engaging environment that seems as much like a game as it does a serious coding curriculum. It has some of the advantages of some of the block-based coding apps (Hopscotch) such as being more approachable and less intimidating than a full, typing-based coding experience, while still giving students a genuine experience with actual Swift code. Students code and solve puzzles through touching and physically manipulating Swift code in the code completion bar. The code completion bar is the feature of the Swift Playground app that makes coding in Swift both easy and understandable for students and powerful to teachers. The power of the code completion bar derives from students being able to use the contextual clues in the code completion bar to guide them in either choosing the correct piece of code or linking successive code snippets together to form a correct line of Swift code.
Students start with learning the basic premise that coding is giving commands to get their program to do something. Students then progress through lessons that cover some of the basic concepts of computer science: functions, conditionals statements, loops, logical operators, and algorithms before they even encounter constants and variables in Learn to Code 2. It is precisely this approach of teaching some of the basics of computer science in a fun and personal manner to students before presenting them with more advanced ideas of retaining values and passing them to other objects or blocks in your code that is the absolute STRENGTH of the Swift curriculum. Any time we, as teachers, can start simple and then scaffold to more difficult topics and concepts, we are providing the best educational experience we can for our students.
Provides a Full, Code-Based Experience
When students are ready for a coding course that is ALL code, then they are ready for App Development with Swift (screencast demo). Students are not just thrown to the wolves by being given Xcode files with which to work. Students start with Swift Playground files for Mac. Just like on iPad, the Swift Playground environment is a simplified UI that allows students to focus on learning Swift code without distraction. However, in the Mac version of Swift Playgrounds, students learn to navigate playground through mouse and pointer clicks and to type all the code. Although, students quickly learn about the Mac and Xcode version of the code completion bar: auto-complete. Auto-complete enables students to more quickly and accurately type their code just as the code completion bar does on iPad. Since students may have had a previous experience in the Swift Playground app for iPad or are cognitively ready for abstract concepts, the concepts of strings, functions, variables, and types are presented in greater depth than they were in the Swift Playgrounds app for iPad. Additionally, students are introduced to more advanced concepts of parameters, arrays, structures, methods, properties, classes, and enumerations. However, these topics are presented in a Swift Playground (as done previously on iPad) so that students can primarily focus on the code and syntax being taught. Furthermore, the apps the students will develop will present teachers opportunities to collaborate and extend the coding lessons into ELA or social studies or mathematics depending upon the content the student may choose to put into his/her app.
Students learn to code by building Swift knowledge and coding skill in small steps (in both Swift Playgrounds for iPad and Mac). Students do this while being hyper-focused on just the Swift code because they do not have to be concerned with why they may have multiple error or warning messages that are presented in a customary Integrated Development Environment (IDE), such as Xcode. Hiding the complex extra code that gives the playground special functionality allows teachers to focus on the specific Swift code and problem-solving techniques being taught in the lesson. The .playgroundbook files are the types of playgrounds that offer a coding experience with a built-in "live view" on the right-hand side of the iPad screen and provides a specific box for students to code in if the author of the playground set it up to do so. The Learn to Code 1, 2, and 3 playgrounds are examples of Swift Playgrounds built with the .playgroundbook files.[^1] Another excellent example of a Swift Playground for iPad built using the .playgroundbook file is Daniel Budd's Geometry with Swift Playgrounds. Mr. Budd's Geometry Swift Playground only displays the geometry lesson materials and requisite Swift code that students need study and iterate over in order to learn the objectives of the geometry lesson. Students never see the hundreds of extra lines of code that are necessary to present the students with a nice, clean interface necessary for students to focus and learn.
The Final Step
When students are ready for the complexity and challenge of building full apps and working completely in Xcode, there is Teaching App Development with Swift which was developed in partnership with Yong Bakos[^2] and approaches teaching Swift by having students develop specific apps. The apps, Bakos argues, provide the motivation for students to learn the requirements, features, and syntax of Swift and Xcode so that students can meet their personal goals of becoming app developers. The Swift curriculum that has been developed by Apple engineers and Apple Education and the curriculum authored by Yong Bakos provide teachers with an innovative and comprehensive approach to teaching coding for late elementary to high school students.