Begin Coding Day 2 - Swift Playgrounds
Welcome to our workshop where we will be exploring key concepts in coding using physical games, creative work and Swift Playgrounds.
Ice breaker (20 minutes)
- Take a selfie and annotate it. Personalise by drawing on it.
- Share it using AirDrop to a class photo album
- Discuss the steps - the procedure and interactions - required to do the task: What did we do? How did it work?
Introduction to Swift and Swift Playgrounds (10 minutes)
Introduction to Swift Programming and Swift Playgrounds (5 minutes)
Playgrounds are environments for learning and testing real Swift code that updates live. Swift is a new programming language. It started on iOS and macOS and now can power software on Linux and Windows. We will use the Swift Playground Fundamentals of Swift to explore the following key concepts in coding:
- Commands and Sequences;
- Debugging, Functions and Loops;
- Thinking Efficiently.
Here’s a short video showing the use of the playground Fundamentals of Swift.
Sharing our work (5 minutes)
We’ll be sharing the material we make using Seesaw. Log in using the iPad app and the picture below (printed in class) .
Then upload your photo created in our ice-breaker and add a reflection (audio, text or video).
.
What do you hope to learn in our session today?
Note your answer to this on SeeSaw
Commands and sequences (1 hour)
Think like a computer: Introduction (5 minutes)
Activity: The class decide on an activity to get you to do. Instead of telling you the activity, they must shout out the step-by-step directions required to perform the action.
Q. How could the instructions be improved?
Activity: Hide and Seek (20 minutes)
Each person should hide an object for someone to find. Then they video themselves giving verbal instructions to find the object. Share / swop videos and try to find each others objects!
Q. How clear were the instructions? Q. What was missing? Q. How could they be improved?
Practice (15 minutes)
In Swift Playgrounds complete the following puzzles:
- Introduction
- Issuing Commands
- Adding a New Command
- Toggling Switches
- Portal Practice
Journal your progress in SeeSaw (10 minutes)
- What is a command?
- What is a sequence?
Reflection (10 minutes)
How many moves did it take to solve the puzzle? How many commands did you write? How does it compare with spoken instructions (in the previous task)? Think of a digital game you play: Names a few commands and sequences that are used? How does thinking like a person compare with thinking like a computer?
Think like a detective: Debugging (1 hour)
Introduction (10 minutes)
Define the key terminology: Bugs and Debugging How do you go about fixing problems?
Activity: Fixing things (20 minutes)
- Detail the steps that show how to fix something.
- What steps are needed?
- Using ““Explain Everything””, draw and recorded an explanation for each step.
- Share your process with the group.
Practice: Finding and fixing bugs to the shortest route (15 minutes)
In Swift Playgrounds complete the following puzzles:
- Finding and Fixing Bugs
- Bug Squash Practice
- The Shortest Route
Journal and reflection (15 minutes)
Journal your progress in SeeSaw. Screen-capture when you complete a puzzle. Upload your notes, images or videos from working with Swift Playgrounds. What did you learn about debugging? What does it mean to ‘think like a detective’?
Reflection
Summarise your experiences around debugging within Swift Playgrounds.
- Did the steps in the previous exercise help with the debugging task?
- Did the process for debugging differ from the general process for ‘fixing’? If so, how so?
- Why is bug-squashing important? Does a small bug matter?
- Can you advise a coder how to avoid bugs?
- Debugging takes time: how can we save time when coding?
Thinking efficiently: Functions and introducing loops (1 hour 30 minutes)
Introduction (5 minutes)
- What is your favourite dance?
- Can anyone perform this dance?
- Can you teach me the dance?
Activity: Pattern Maker (20 minutes)
You have 3 Minutes, working in pairs: Create a repeating pattern with different shapes and colours. You will use “Explain Everything” to create and present your patterns.
- Write the pattern using words 20 times;
- Find a repeating block and give it a name;
- Write the pattern again, replacing the repeating block with the new ;
- How does this relate to coding?
Practice: Functions and for loops (1 hour)
In Swift Playgrounds complete the following puzzles:
- Introduction
- Using Loops
- Looping All the Sides
- To the Edge and Back
- Loop Jumper
Journal and reflection (5 minutes)
Record your progress in SeeSaw. Screen-capture when you complete a section. Upload your notes, images or videos from working with Swift Playgrounds.
- What did you learn about loops?
- What does it mean to think efficiently?
Reflection
- How many moves did the character make?
- How many commands did you need to write?
- When and why should you create functions and loops?
- What other functions would/could you create to help Byte solve the puzzles?
Thinking ahead
Question: How do we stop a ‘for loop’?
Break (15 minutes)
Practice: Functions and for loops (1 hour)
In Swift Playgrounds complete the following puzzles:
- Introduction
- Using Loops
- Looping All the Sides
- To the Edge and Back
- Loop Jumper
Journal
Record your progress in SeeSaw. Screen-capture when you complete a section. Upload your notes, images or videos from working with Swift Playgrounds.
- What did you learn about loops?
- What does it mean to think efficiently?
Reflection
- How many moves did the character make?
- How many commands did you need to write?
- When and why should you create functions and loops?
- What other functions would/could you create to help Byte solve the puzzles?
Plenary - review and reflect (15 minutes)
Review the concepts covered so far In Swift Playgrounds complete the following puzzles that pull together the concepts covered so far. Note about your progress and collect images for your journal.
- Branch Out
- Gem Farm
- Four Stash Sweep
What next?
Swift playgrounds are a way to explore and learn code by directly interacting with simple views of real code. Find more in the resource list and explore in your own time.
Next we will look at animation and digital design.
How do we make creative visuals for our apps and games?