Summit sally cover?fm=jpg&fl=progressive&q=75&w=300

Extracurricular Swift

Swift is praised by many developers, but it also opens up exciting opportunities in education. In this talk, Sally Shepard emphasizes the importance of teaching kids to code, and explains why Swift could be an amazing tool for learning. She discusses challenges that exist with the current Swift tooling, possible solutions, and most importantly, ways that you can get involved.

Opportunity & Need (0:09)

Today, I’m here to talk about Extracurricular Swift. Lots of people will talk to you about Swift. They’ll talk about type safety, as well as relying on the compiler and optionals. They’ll talk about functional patterns and functions as first-class objects. But I want to talk about the potential of Swift in learning, and how we can use its clear, concise syntax to teach the concepts and practices of programming.

Why teach kids to code? Learning to code doesn’t mean funneling every child into a job as a programmer. By the time they are adults, the job landscape will have changed probably beyond our imaginations. The real benefit of teaching kids to code is passing on the skills that are useful in many other paths of life. Ordered thinking, problem-solving, abstraction, and attention to detail are general skills that benefit any occupation.

Bridging the Gap with Swift (1:05)

Resources in schools are often limited, and it’s difficult for teachers to not only maintain knowledge of technology, but also to learn new technologies. Because of this, it is essential that we have ways of complementing the current curriculum. When I heard about an after school club for teaching children to code, I was really excited and wanted to get involved. A few months ago, I went to an induction session for Code Club, excited about the possibility of teaching kids.

Get more development news like this

For those of you who don’t know what Code Club is, it is a program for children ages nine to eleven. It’s a volunteer-led after school coding club, and it takes place one hour a week during term time. They learn programming starting with Scratch, working up to HTML and CSS, and then on to Python.

After school clubs like this are often the only place where children can discover what is going on behind the scenes of the games that they play. These clubs are great for them because they’re not forced to be there - they actually want to be there. This creates a different relationship to learning. We programmers are a huge, untapped reservoir of knowledge and enthusiasm. We’re a passionate, excited, and friendly community, and I think that we can make a real difference. It would be amazing to leverage that excitement and pass it on to a new generation of programmers.

Code Club Curriculum (2:34)

I wanted to spend some time helping kids to learn to code, but I personally couldn’t commit to running my own Code Club. So, I’ve been looking at the Code Club tools and examining them as a framework for how Swift could be an amazing tool for learning. Before I get into what I have actually worked on, I want to give a brief overview of the current curriculum structure in Code Club.

The first two terms involve using Scratch to build programmatic structures like loops and conditions. It uses little coloured blocks, and it has immediate results. Because it is all drag and drop, the focus is on learning logic and not on learning a language. Scratch is mostly targeted at making simple games as a way of getting children interested. After completing Scratch, the students can move onto a term of doing HTML and CSS, where they get to build some simple websites and learn how to style them. Afterwards, they move on to Python. It builds well off of all the things that they have learned so far, and focuses on learning more about programming languages. They learn things like printing text, catching errors, working with variables, conditionals, loops, libraries, and collections. It also provides a decently comprehensive introduction to structures and data types.

Why Python? (4:01)

Why are the Python language and tools a good choice for learning? Python has a very simple and clear syntax. There is no division between primitives and objects, and no complications around pointer notation and memory management. It focuses more on what to do, not how to do it. Furthermore, it’s widely available. Python has so many libraries for functions like math and drawing, and it has a huge choice of interaction methods. Code Club mainly uses Python’s IDLE, but there are also web-based tools.

Swift as an Alternative (4:41)

Now that we know a little bit more about Python, let’s look at Swift in comparison. Swift embraces most of the points that made Python a good choice: simple syntax, a focus on what over how, and a great library of support from Foundation and UIKit. In less than a year, Swift has become hugely popular — just imagine where it will be in five to ten years. Currently, there are three main ways of accessing Swift.

The first of these is Xcode, which gives you access to full projects and playgrounds. Playgrounds allow you to use a huge spread of libraries and features, and you can live-code anything from “Hello, World!” to SceneKit 3D game views.

Secondly, the Swift REPL is the closest match for Python IDLE. We have seen how we can use the REPL for scripting, and it can be accessed just by typing swift into the command line. You’ll need the command line tools package to be installed. REPL allows commands to be typed and executed immediately, referencing previously typed declarations and commands. Alternatively, you can pass in a file at the command prompt, and it will be executed automatically. You can also specify command line arguments, which can be accessed via processes to arguments.

Thirdly, there are also some great web-based resources for running Swift, like runswiftlang. It’s quite cool, but is restricted. You only get access to some of Foundation, and there is little else you can do in terms of UI. The big advantage to these tools are that you can run them on any computer that has access to the internet, without installing any software or tools.

Challenges (6:28)

There are challenges to overcome before Swift can be embraced fully as a learning tool. The biggest problem is that schools don’t have Macs. Some of them do, but the majority don’t. A school is most likely to have PC hardware that runs Windows, and there are usually safeguards in place to limit content access outside of the school network. There are also restrictions on installing additional software on any of these machines. At the end of the day, this is a potential roadblock. You either need Mac hardware to fully engage with Swift, or you need to use web-based tools and accept the limitations that come with them.

Possible Solutions (7:15)

Outside of having direct access to Macs or using web-based tools, there are a few other options that I was looking into. You could SSH into your Mac and run the REPL. You would use a single Mac with the command line tools installed, either added to a local network or remotely located and accessible through a firewall as a server. Then, open up SSH sessions in a command line on any platform to access the REPL. The difficulty with this is that you would need a Mac somewhere, and you still wouldn’t have access to playgrounds.

You could also give visual access to the Mac to use playgrounds across VNC or other screen-sharing technologies. With this option, you would again still need a Mac somewhere. There could probably be performance issues, but you would have access to Xcode, playgrounds, and the REPL. You could also run OS X in a virtual machine, which would enable both Xcode and REPL access. This would require the school to keep Xcode up to date, and for their IT team to actually know how to use Macs. This could also have lots of performance issues, since most of the computers in schools are probably not designed to run Xcode.

A third option would be to try for some corporate sponsorship to finance a small mobile Mac lab. You wouldn’t have to interfere with the school’s hardware or network, but you would still have to deal with individual school requirements including but not limited to what what software is installed, how said software is monitored, and who would be in charge of the upkeep.

Limitations on Input (8:45)

The REPL and playgrounds are missing one significant feature that Python actually possesses. This would be an easy way to capture input from devices, which is commonly standard input from the keyboard. This input allows interaction with running code. That immediate feedback is a great way of providing a reward for work when children might have a small attention span. Although REPL has access to command line arguments, this is still limited and not in real time during the execution.

What about Windows users? Well, maybe you could use you skills and imagination to build tools for making Swift easier in other environments. Could we make playgrounds that work on Windows? Perhaps we could work on some full-featured web-based tools.

Get Involved! (9:34)

Kids need the opportunity to learn to code, not just to be the next generation of programmers, but for general life skills. Swift is an amazingly suitable language to help kids understand the concepts and practices of programming. The tools are still maturing, and need our input and innovation to reach ubiquity of other languages. Our community is so ideally placed to make a difference in the education and abilities of children. We owe it to them to make the effort.

There are a number of ways to get involved. The two organizations that I am familiar with are Code Club and STEMNET. So, go run a Code Club! You don’t have to run one on your own. In fact, it is better to get a couple people involved, and there is also a teacher with you at all times. You can also try to get your employer to send a few people from your team to teach in shifts.

You could also host a club. These don’t have to be in schools; they also take place in libraries and community centers. If you know a place that could support this, talk to them. You could also volunteer to teach teachers so they can better support students. Many teachers don’t have the training to properly teach the new computer curriculum. Help them get to where they need to go. If you’re worried about commitment, or maybe terrified of children, all of their material is on GitHub here. You can make some really cool new projects for them if you have any great ideas. There are also more than three thousand Code Clubs worldwide, so there is a massive need for the materials to be translated into other spoken languages.

At STEMNET, you can volunteer on a more ad hoc basis. They do lots of career fairs and classroom talks. They also have active forums where you can help teachers and other volunteers out. They also the background checks that you might need, so Code Club actually recommends going through them to get your background check.

Ultimately, as developers, we make magical, wonderful things. If you have lost that feeling of making something magical, then spend some time teaching kids, and you’ll get that feeling back.


About the content


Sally Shepard

Sally is an iOS developer, consultant & speaker. She loves working on accessibility, which led her to successfully kickstart Inclusive Tools. She likes to spend her free time working on cat wearables with her pet/tester, Pavlo.

4 design patterns for a RESTless mobile integration »