More Advanced Apps: Segues and Navigation Controllers

We’re in the thick of a hackathon project and some students are plowing ahead with their prototypes and looking to turn them into full-blown apps.

In this new video I walk you through a pretty common scenario.

Many of our apps are going to have more than one screen. And what appears on subsequent screens is going to depend on what a person has tapped on or possibly something they’ve typed in or a way they’ve interacted with a previous screen.

So we need a way to pass data from one screen to the next. This topic is covered in Develop in Swift Fundamentals in Lesson 3.6, Segues and Navigation Controllers.

Our segue will be our go-between our original, or our source, view and our destination view. And there’s a little bit of sort of magic* involved.

Check out the video below for some steps through creating another View Controller that will be our destination view, the code that backs it, a connection to the new view, and how to wire up passing data between the two.

Best of luck building out your more complex app!

* Well, not quite “magic.” More like hooks into the very inner life of our iOS app like we’ve got a pair of X-ray specs and suddenly we can see all this cool underpinning of our apps going on that maybe we didn’t realize was there before.

App Development Workshop Follow Up

I hope you’re all enjoying the summer. It’s been sunny and warm in Ireland, thank goodness, so we’ve been spending our time outdoors as much as possible!

But we did get inside to do some coding when we recently ran a series of workshops to introduce new coders to the Develop in Swift series as part of an app development challenge.

If you’ve been reading Develop in Swift Explorations or Develop in Swift Fundamentals , I’ve recorded a video that takes some of the concepts and an approach to building an app and walks you through one way to do it.

I give you some pointers to lessons in Fundamentals or projects in Explorations that you might explore to learn more.

Check it out and we’ll be back soon with some more videos and coding tips!

Build your own QuestionBot

Happy WWDC! It’s that magical time of year when developers working on Apple platforms have all their dreams come true!

Well, okay, maybe not, but we get a very fun week of new tech and demos and excitement about the platform.

If you’re watching all of this (or watching the people watching it and wondering what the heck is all the fuss about), we’ll probably have some words about it this week. But before that all kicks off, I threw a little playground up for you to experiment with, especially if you’re new to Swift, Apple’s programming language for iPhone, iPad, Mac, Apple Watch, and AppleTV apps.

QuestionBot

There’s a really fun exercise in Develop in Swift Explorations called QuestionBot. In it, you build the brains of an app to answer whatever question a person might type in. You can make it super complicated, or very, very simple.

We use this exercise during our Teaching Develop in Swift online class, and it’s usually impressive how different the apps can be.

Well, now, even if you don’t have a Mac, you can play around with QuestionBot. I created a REPL on replit.com with some simple instructions so that you, too, can create a functioning QuestionBot. Try it out:

http://replit.com/@mhanlon9/questionbot

There are two files, just tap on the Code tab and you’ll see main.swift and QuestionBot.swift.

Those show you the brains of our app.

The fork button

If you want to edit the code, just tap on the Fork button, which will create a copy of the code. You need to create a free replit.com account or link it to your Google, Github, or Facebook account, if you have one.

If you want to change QuestionBot’s behavior: how it asks questions and how it answers them, look in the QuestionBot.swift file.

If you want to change something else about the program, maybe limit it to only allowing you to ask three questions, or only letting people ask it questions on a Thursday, you would edit the main.swift file.

Coding for All

I really like replit.com because you can use it with any device, and it’s a great way to get an introduction to Swift before jumping in with an iPad or Mac.

I’ll be recording a short video introducing the QuestionBot on replit.com in the near future, but in the meantime, good luck coding!

Middle Schoolers Exploring Coding

For those who aren’t as interested, they’re still going to be learning determination, perseverance and trial and error.

from the ReMarker, February 2021, “In a Growing Industry” by William Fitzpatrick Junior of St. Mark’s School of Texas
What is coding?

Issu had an interesting article from a middle school in Texas about the success of their coding program, which runs from fifth to eight grade. They equip their students with designated computer science teachers in all the grades, which is a huge leg up.

I think it’s a brilliant program they have for the kids, but my favorite piece of the article was the quote above. “For those who aren’t as interested.”

That’s a huge segment of the population. Those people who don’t know that much about coding, or maybe they do, and they find it’s just not for them (or don’t know if it’s for them or not).

In the Beginning

In the beginning of your coding career, whatever form that takes, you will likely find some use for coding that suits your needs. It’s how I started.

Where some people might thrill to solving puzzles for the sake of solving them, others may need a specific need met. This is why I love seeing the cross-curricular work that folks like Michael O’Kane, Giovanna Busconi, and Daniel Budd (and more) have put out there to teach coding under the auspices of history, or literature, or math. Maybe that’s how you started: you saw an application this skill in a field completely separate from computer science itself.

Explorations

Apple has an excellent curriculum designed for these sorts of folks: they might not fully get what coding is all about, but they use technology in their daily life, as most of us do, and could potentially benefit from another tool in their tool belt.

Develop in Swift Explorations: https://apple.co/developinswiftexplorations

It’s called Develop in Swift Explorations.

You need a Mac and Xcode 11 (at least), but this course will introduce you to coding in the context of your daily life: how the device you use, like your phone, uses coding and how much of our daily interactions rely on coding and processes we might not have even thought of!

Like Everyone Can Code and the other Develop in Swift books, it’s a self guided book with student resources to download which include labs. At the end of each lesson you have a lab to complete that will help you practice your new found skills.

Explorations for Teachers

If you’re a teacher who wants to try using this material with your students (it’s aimed at high school or university students), I’m running a free week-long session in March that might help.

We’ll cover the Explorations curriculum, as well as the Develop in Swift Fundamentals course. Fundamentals is more of a computer science course, but still a great introduction to coding. We take you through the books and get you familiar with the material and ways you can teach it.

You can register here: http://s.apple.com/dE5i4p0g8b

This is a golden opportunity to meet some amazing teachers and coders. We’ve had some incredibly diverse audiences in the past, and this time should be no different. But it’s also a chance to ask questions about the material, and how we teach perseverance and determination. It’s going to be intense, with lectures and workshops in the morning. Then we’ll have a bit of homework and some showcases, group discussions in the afternoon. You’ll get the chance to meet the instructors in smaller groups to ask pointed questions or just have a chat. And each evening we have a special guest of some stripe scheduled.

So if you’re a teacher, you’re more than welcome to come along with us! Sign up at the registration link above, make sure you have a Mac handy, and we’ll start you on your coding adventure.

If you have any questions, feel free to join our Teaching Swift Slack instance, where you can drop me a note.

I hope to see you the first week of March!

Quick Start to Coding at Home

We held some live coding sessions during EU Code Week 2020. They included unplugged activities, away from the iPad, and then a follow-along session of coding in various Swift Playgrounds.

Now, these sessions were a ton of fun in the classroom, but if you find yourself schooling at home again, like we are in Ireland, these sessions are great breaks from the regular school day. (Not to toot our own horn or anything!)

A bit of structure

There are ten sessions in the Quick Start to Code with Swift and we have ten pages that explain each day.

We have a short explanation of the day’s lesson, followed by an embedded video of that day’s recording. After the video we have an explanation (including what materials you need) for the unplugged session. The next section give you ideas about how to extend the lesson, if you found it really easy, or really enjoyed the coding. And the final section has code samples to help you solve that day’s puzzles. There’s even a handy copy link to copy the code and paste it into your Swift Playground, if you’re browsing the web pages on your iPad.

At Home

So if you’re a teacher, or a parent, or a student, the site will guide you through Apple’s excellent Quick Start to Code with Swift.

It’s not ideal, to be remote learning again, when I know our secondary school kids were loving being back in the classroom and back in some semblance of normality. But hopefully our EU Code Week content will keep you going and help change the pace a bit.

Maybe try jumping on a Zoom or WebEx call with your friends and work on your dance moves in the unplugged segments. Or arrange to all try the puzzles from a particular day. Sometimes it helps to talk through and work on the code for a shared problem.

What Comes Next

We have some ideas about where you can go next, once you’ve completed the quick start.

And we’ll be back, very soon, here, to guide you through some more coding. So have those iPads ready, brush up on your Swift, if you want, and we’ll see you again, really soon!

EU Code Week 2020: That’s a Wrap!

It has been a wild and woolly ride, but you can now watch all TEN days of A Quick Start to Code with Swift follow-along sessions!

Steve and I recorded the last few extra days and posted them a little earlier.

Follow-Along Coding Sessions

If you’re just coming to the party, the sessions run around 40 minutes or so and are designed to fit into a classroom period.

We wrote up some instructions and tips for holding a code-along session in your own classroom. Or maybe you want to trial this on your own kids at home. Well, we have instructions for running these sessions at home, too!

Structure

The extra sessions follow the same formula as the first five. We start off with a brief intro to the day’s topic. Then we show you a very cool ‘unplugged’ activity where we exercise the concepts for that day’s lesson. Once we’ve gotten everyone up out of their seats and moving, we gather back around the iPads and Swift Playgrounds for some coding.

On some days we had special guests, which always added an extra bit of excitement to the sessions, and I can’t thank the schools from Scotland, Sweden, Norway, the Netherlands, and Ireland enough for joining us!

Recap

You can view the entire series of videos on their own here: https://www.thecodehub.ie/eu-code-week-2020/playlist.html

And you can always prepare for each class by referring to our handy site, which contains added context, descriptions of what you need for the unplugged portion, and things you can do to challenge students who are blazing ahead.

I really had a blast coding along with you for ten days. Hopefully this has ignited a little spark for you. Coding is just another way of expressing ourselves, and we found an number of ways of doing that in these ten days. If you keep going, keep practicing, you’ll find all sorts of new ways to solve problems. And then who knows where it can take you?

The Ten

These are the ten sessions, for easy clicking:

A Quick Start to Code: Find Patterns

Steve and I are back with Earlston Primary School in Scotland to talk about finding patterns, from the Quick Start to Code with Swift PDF from Apple.

We talk a lot about finding patterns and turning those patterns we use repeatedly into functions. Find out more on our mini-site for our extended EU Code Week sessions.

What’s in a Function?

A function is a way to group a set of commands you’ve deemed useful enough that you want to re-use. So to write a function we need to think about what problem we’re trying to solve.

Your first pass may also not be your last! Often we’ll revisit code after solving a problem to see if we can improve on our original solution.

Unplugged

With Steve we work on turning left to turn right in the real world and we also play a game of “Dots.”

Come check out our session and get back to Swift Playgrounds with us!

https://www.thecodehub.ie/eu-code-week-2020/day2.html

EU Code Week: Going Further

So you’ve started your coding career, or maybe just progressed it a little. Now you’re looking for where else to go to learn coding.

Well, we have good news! We’ve taken a look at the other days in the Quick Start to Code with Swift PDF and are busy recording the next five days.

Five More Days!

You can check out newly beefed up mini-site for the focus of the new days.

We’ll be adding more details, especially around the unplugged segments, as the next few days go by. In the meantime, you can try your hand at the code for each day, as we have sample code, ideas for extending the material if you or your class is flying ahead, or you can learn more about the ideas behind the lesson.

When we’ve recorded the session we’ll post the video on the corresponding page so you can use it in class, just like our other days.

Going Even Further

But what if you’ve done all the extended ideas for the coding, all the unplugged sessions. You’re danced out and your brain is electrified with possibilities of coding!

Well, we have a Going Further page on the mini-site that will give you places to go, material to explore. From more Swift Playgrounds to other realms of coding, like Augmented Reality, to Xcode and building apps for iPhones and iPads and Macs, on Macs.

You’ve taken the first, very exciting steps in your coding career: where are you going to take it from here?

EU Code Week: Play Your Own Game Again

Join us live today at 9:45am, Irish/UK time for another follow-along coding session!

For context (and last week’s recording), you can visit our mini-site: Day Nine: Play your own game

We follow Apple’s Quick Start to Code with Swift PDF (and skip a few days, for now), which is why Friday is Day Nine.

Unplugged

Steve will teach us the rules of Rock, Paper, Scissors. This is important, because to turn this into a game we can code, we need to understand the rules, or the mechanics, of how the game works.

We’ll play a few spirited games, so make sure you’ve limbered up your fingers!

Coding

What better use of coding than to write your own game?

Well, today we’ll take the game Rock, Paper, Scissors, and turn it into our very own game. With code we’ll be able to customise the game, tweak it to our heart’s content.

So come join us, learn a little bit of coding, and start building your own game!

See you at 9:45am, Irish/UK time!

EU Code Week: Track the Gems Again

Join us live today at 9:45am, Irish/UK time for another follow-along coding session!

For context (and last week’s recording), you can visit our mini-site: Day Six: Track the gems

We follow Apple’s Quick Start to Code with Swift PDF (and skip a few days, for now), which is why Thursday is Day Six.

Unplugged

Okay, take a seat. Today we’re going to break down (not breakdance) our favourite dances. What is the name of the dance? What’s the duration?

Steve helps us to learn a little about variables when we consider what elements make up our real-world bouncing and bopping around.

Coding

We learn about variables today and have to dive into the Learn to Code 2 playground. This is a big step, and a HUGE new coding concept to learn.

We’ll use variables to keep track of the gems that Hopper collects as we solve the puzzles in today’s session.

See you at 9:45am, Irish/UK time!