Apple's new Swift Playgrounds for iPad is a killer app for teaching code

Posted:
in iPad edited June 2016
At WWDC, Apple introduced Swift Playgrounds as a "revolutionary new app for iPad that makes learning Swift interactive and fun." A closer examination shows the new app is a powerful authoring tool any developer can use to teach critically important software coding skills.


Swift Playgrounds for iPad at WWDC 2016


Apple's focus on Swift



Apple first introduced its new Swift programing language at WWDC 2014, building upon groundwork invested in the company's development tools ranging from its LLVM compiler to its Cocoa and Foundation frameworks.


Swift Playgrounds in Xcode


Alongside Swift 1.0, Apple also introduced Playgrounds in Xcode (above), a tool to provide immediate visual feedback of Swift code as it ran. Since then, the company has worked to advance Swift development in tandem with feedback from developers and partners including as IBM.

This year, Apple demonstrated a new version of Playgrounds customized for iPad (below). It supports advanced multitouch gestures for selecting and editing code by touch, as well as a new development-oriented keyboard with code completion suggestions.




The company profiled the new app as an "innovative new app for iPad that makes learning to code fun and easy for anyone," and briefly introduced its series of programming lessons within the app designed to introduce new users to the world of writing code.

A platform for teaching Swift



Apple depicted the new Swift Playgrounds app for iPad--which will be publicly released for free this fall as part of iOS 10--as a fun way to introduce children to code development concepts (as show in a preview video clip below).



"In Swift Playgrounds, you create small programs called "playgrounds" that instantly show the results of the code that you write," Apple notes on its Swift Playgrounds page. "A single line of code can make amazing things happen. Interactive lessons teach key coding concepts, and additional challenges and templates encourage you to explore code in exciting new ways and to create something completely unique. It's easy to share your creations with friends, or record and post videos of your playgrounds in action."

Beyond being a basic coding concepts tutorial, Swift Playgrounds also opens the door for third parties to create their own Swift lessons in the form of interactive Playgrounds Books.

Playgrounds Books are written in Swift code as collections of Pages, organized into Chapters, that present an interactive lesson somewhat similar to iBook Author. Rather than just being dynamic iBooks with some interactive elements however, Playgrounds Books contain live code that a user can interact with and then immediately see the results of within Playgrounds.

For beginners, a Playgrounds Book might initially start with a page that introduces a line of code with a selectable variable the user can change. To create this, the Book developer can hide much of the code involved behind the scenes (as Hidden Code) and only highlight Editable Regions, using markup in the code that makes up the Book.

Descriptive text and graphics, starting with an introductory "cut screen" page that introduces the topic of the lesson, can be used to guide the user through a given lesson.

A dynamic workbook



As the Book progresses, descriptive Playground Markup can incrementally introduce increasingly complex functions and code concepts that require the user to enter more of their own code, using the onscreen keyboard, code suggestions or segments of code in a library of snippets.

A Playgrounds Book developer can also include interactive glossary items that describe what an included phrase means, and present Hints that guide the user through the lesson.

As the user interacts with the code in Playgrounds Book pages, a live preview can provide immediate feedback. The user can also undo steps to repeat a section or try different inputs.

Additionally, at any point a user can stop a lesson, erase their progress or edits and reset the lesson over from scratch. This makes Playgrounds Books an ideal way to teach classes of students how to code, as each student's work is kept separate from the core content of the Book.

Apple outlined how the new Swift Playgrounds app for iPad will work, along with demonstrations, in the WWDC 2016 video Introducing Swift Playgrounds.




Not just for kids



While Apple has created some initial lesson Books aimed at users completely new to programming (and announced plans to incrementally introduce a veritable library of new Books for the app), Swift Playgrounds isn't just for teaching new users how to code.

"Using Swift Playgrounds, you will code real programs within minutes and even as you become more proficient, you will never outgrow Swift," Apple states on its site.

"Sometimes the best way to learn is to explore on your own, and Swift Playgrounds is a great place to let your imagination run wild. In addition to the lessons that help you learn to code, Swift Playgrounds delivers new challenges on a regular basis so you can keep coming back to try something new. Some challenges are fun ways to play with code to create interesting effects, while others include engrossing puzzles that requires all of your coding skills to solve."

Apple also demonstrated Playgrounds working with variety of iOS frameworks, including SpriteKit and SceneKit for working with 2D and 3D graphics, and Bluetooth for programmatically interacting with other devices wirelessly (including a Spherio robot toy, which was shown on stage being manipulated by lines of code in the new Playgrounds app).

Apple also noted that "because you are coding and running your playgrounds on iPad, your code can respond to touch gestures or interact with hardware such as the camera, accelerometer, and gyroscope," adding that "with access to thousands of APIs in the iOS SDK, you can create amazing playgrounds that explore the web, generate 3D worlds, experiment with physics, and much more."

Apple's history in visual development



While the approach used in Swift Playgrounds involves lots of new innovation and technology, it's not the first time the company has created visual tools to expand interest in development concepts to a broader audience.


Source: Quartz Composer


In 2005 Apple introduced Quartz Composer (above) as part of Xcode in Mac OS X 10.4 Tiger. It presented a graphical interface for patching together inputs and processor units to create macros that could be output as dynamic Screen Savers, iTunes Visualizers or other programmatic graphic animations, without any advanced coding experience.

Facebook used Quartz Composer to rapidly prototype a design interface for Home, its failed initiative in 2013 to integrate Facebook onto the home screen of Android phones. The company had hired former Apple user interface developer Mike Matas to work on Home after acquiring his Push Pop Press initiative to build a tool to create interactive, dynamic ebooks, founded in 2009.

In 2010, Apple introduced iAd Producer (below), a graphical development tool for building dynamic ads using JavaScript and HTML5 as an alternative to Adobe Flash.


iAd Producer


Apple subsequently released a development tool for building ebooks in iBooks Author, which it released in 2012 as a way to build iBooks for iPad (and later for Macs with the release of an iBook app). The tool enabled developers to build native code widgets to expand the interactivity that could be included in iBooks.

Apple's ancient history in visual development



Much further back, Apple released HyperCard (below) in 1987. The program was developed over the previous two years by programmer Bill Atkinson, who then assigned the rights to Apple under the condition that it would bundle it for free on all new Macs.


HyperCard


HyperCard enabled non-technical users to build interactive "stacks" of hyperlinked pages using an easy to understand scripting language called HyperTalk. HyperCard helped inspire Steve Jobs' NeXT, which introduced Interface Builder in 1988 as a rapid application development tool (and is now part of Apple's modern Xcode development tools).

HyperCard also helped inspire the development of the web by Tim Berners-Lee, a project which originated on NeXT systems using its Interface Builder development tools. HyperCard was also ported to X Window for Unix by Pei-Yuan Wei at UC Berkeley to deliver Viola, which then adopted web protocols to become an early web browser, and served as a model for NCSA Mosaic, the foundation of Netscape.

Like HyperCard, today's Playgrounds is intended to introduce broad new audiences of users to the skills required to build modern software. At WWDC, Apple profiled a broad range of programers who have learned to code and use their skills to build tools to solve a wide variety of needs.
bestkeptsecret
«1

Comments

  • Reply 1 of 21
    frantisekfrantisek Posts: 400member
    Does anybody knows whether iPad 2,3,4 will be supported or it will be 64-bit App only? I was searching like crazy but found nothing.
  • Reply 2 of 21
    LoneStar88LoneStar88 Posts: 279member
    I've had iPads in the past and enjoyed using them, but later sold or let them go for lack of much use. No fault of the device. I just didn't use them as my activities changed.

    I've wanted to learn Apple programming for many years—at least 20—but was always frustrated for lack of a workable, clear-cut "path" to learn.

    Now with Swift, and especially this new Swift Playgrounds on the iPad, there is new hope of such a path.

    It also gives me a new and important reason to get a new iPad Pro!

    I'm excited!
    slprescottcoolfactorjustadcomicsmoreckjony0
  • Reply 3 of 21
    auxioauxio Posts: 1,975member
    I like the idea here, but it's still a bit too advanced for my 6 year old son since there's a lot of reading to get through before you get to make things happen (his reading comprehension and attention span aren't quite there yet).  So I've opted for Osmo Coding for now since it's tactile and immediate.  But this will be the next step for sure once he's ready.
    moreck
  • Reply 4 of 21
    coolfactorcoolfactor Posts: 1,429member
    HyperCard was my gateway into programming and database development. I now have my own business and work full-time as a developer, PHP being my language of choice. HyperCard truly was amazing. Logical, clean, fun, and effective.
    edited June 2016
  • Reply 5 of 21
    nolamacguynolamacguy Posts: 4,758member
    as a dev, i think it looks like an engaging way to get kids and beginners into learning about programming. sounds great. (just dont ask the negative nancies and trolls from the last article on it...those folks were convinced it sucked because it, uh, isnt Xcode, a full IDE, etc...)
    lolliver
  • Reply 6 of 21
    wizard69wizard69 Posts: 12,719member
    frantisek said:
    Does anybody knows whether iPad 2,3,4 will be supported or it will be 64-bit App only? I was searching like crazy but found nothing.
    I don't know! A beta of iOS for iPad 3 has yet to come out. Considering how something like Swift ft Playgrounds would have to work I really doubt it will be that great on old hardware if it did run. I would imagine that there are several threads of execution going on to support that interactive environment. This leads me to thinking dual core at the least and lots of RAM.
  • Reply 7 of 21
    smiffy31smiffy31 Posts: 173member
    frantisek said:
    Does anybody knows whether iPad 2,3,4 will be supported or it will be 64-bit App only? I was searching like crazy but found nothing.
    They said at the Keynote that is was for iOS 10 only so no iPad 2 at least but we will have to wait and see. That said this has to be embarking LLVM and clang to do its magic and apears to be a (almost) complete REPL ! The iPad 2 is probably not enough.
  • Reply 8 of 21
    jasenj1jasenj1 Posts: 912member
    Will the iPad Swift Playgrounds also work on Macs, e.g. the Playground Books? There seems to be a flow between the iPad and Mac but the exact nature is a bit fuzzy. I like the idea of coding lessons, but I'd rather see/do them on a Mac.
    edited June 2016
  • Reply 9 of 21
    dick applebaumdick applebaum Posts: 12,505member

    HyperCard also helped inspire the development of the web by Tim Berners-Lee, a project which originated on NeXT systems using its Interface Builder development tools. HyperCard was also ported to X Window for Unix by Pei-Yuan Wei at UC Berkeley to deliver Viola, which then adopted web protocols to become an early web browser, and served as a model for NCSA Mosaic, the foundation of Netscape.

    Like HyperCard, today's Playgrounds is intended to introduce broad new audiences of users to the skills required to build modern software. At WWDC, Apple profiled a broad range of programers who have learned to code and use their skills to build tools to solve a wide variety of needs.

    Good article!

    But, I think you give too much credit to HyperCard for influencing development of the web.  Ted Nelson coined the word HyperText in 1965 -- gave lectures and published books on the subject -- before the Mac or NeXT even existed.  I suspect that both Bill Atkinson and Tim Berners-Lee were influenced by Ted Nelson.

  • Reply 10 of 21
    dick applebaumdick applebaum Posts: 12,505member

    jasenj1 said:
    Will the iPad Swift Playgrounds also work on Macs, e.g. the Playground Books? There seems to be a flow between the iPad and Mac but the exact nature is a bit fuzzy. I like the idea of coding lessons, but I'd rather see/do them on a Mac.
    That's a good idea!

    Apple didn't announce Swift Playgrounds for the Mac ...

    But it, certainly, could be ported to the Mac -- the Swift Playgrounds app is written entirely in Swift.

    Likely, you would lose some iPad advantages, use of:
    • the gyroscope and accelerometer
    • the Cell radio
    • a dynamic keyboard that updates to include functions as you define them (kind of a high level code completion)
    • touch to drag/expand the scope of a code function or loop to encompass existing code
    The 2 latter items could be addressed on a Mac with a Mouse/Trackpad that supports gestures and an existing functions area on the display.

    kevin kee
  • Reply 11 of 21
    auxioauxio Posts: 1,975member

    HyperCard also helped inspire the development of the web by Tim Berners-Lee, a project which originated on NeXT systems using its Interface Builder development tools. HyperCard was also ported to X Window for Unix by Pei-Yuan Wei at UC Berkeley to deliver Viola, which then adopted web protocols to become an early web browser, and served as a model for NCSA Mosaic, the foundation of Netscape.

    Like HyperCard, today's Playgrounds is intended to introduce broad new audiences of users to the skills required to build modern software. At WWDC, Apple profiled a broad range of programers who have learned to code and use their skills to build tools to solve a wide variety of needs.

    Good article!

    But, I think you give too much credit to HyperCard for influencing development of the web.  Ted Nelson coined the word HyperText in 1965 -- gave lectures and published books on the subject -- before the Mac or NeXT even existed.  I suspect that both Bill Atkinson and Tim Berners-Lee were influenced by Ted Nelson.

    Not to mention Engelbart's demo of a working HyperText prototype in 1968 which astounded followers of Nelson's ideas.
  • Reply 12 of 21
    dick applebaumdick applebaum Posts: 12,505member
    auxio said:

    Not to mention Engelbart's demo of a working HyperText prototype in 1968 which astounded followers of Nelson's ideas.

    Ah, yes:  The Demo ...

    Its worthwhile to go back and watch that every year or so.

    Most of the ideas presented are now in common usage -- one exception is the one-handed chord keyboard for typing.

  • Reply 13 of 21
    knowitallknowitall Posts: 1,235member
    Hmm, nice.
    Reminds me of the basic interpreter on the TRS-80 I learned coding on in 1979.
    It's comparable I think to Mathematica's interactive coding environment.
    A pity that programs cannot be compiled and loaded by the OS; it could have been a real computer by now, instead of a toy.
  • Reply 14 of 21
    nhtnht Posts: 4,429member
    As I mentioned before it's not that different than Code.org at first inspection.

    Nice of Apple to do but thus far I haven't seen anything compelling enough to switch direction.  I'll certainly download it and give it a whirl.
  • Reply 15 of 21
    macplusplusmacplusplus Posts: 1,604member

    HyperCard also helped inspire the development of the web by Tim Berners-Lee, a project which originated on NeXT systems using its Interface Builder development tools. HyperCard was also ported to X Window for Unix by Pei-Yuan Wei at UC Berkeley to deliver Viola, which then adopted web protocols to become an early web browser, and served as a model for NCSA Mosaic, the foundation of Netscape.

    Like HyperCard, today's Playgrounds is intended to introduce broad new audiences of users to the skills required to build modern software. At WWDC, Apple profiled a broad range of programers who have learned to code and use their skills to build tools to solve a wide variety of needs.

    Good article!

    But, I think you give too much credit to HyperCard for influencing development of the web.  Ted Nelson coined the word HyperText in 1965 -- gave lectures and published books on the subject -- before the Mac or NeXT even existed.  I suspect that both Bill Atkinson and Tim Berners-Lee were influenced by Ted Nelson.

    HyperCard was the graphical implementation of Ted Nelson's ideas, but it was not the first, Brown U.'s hypermedia system had precedence.

    The "Web" is direct and more loyal implementation of Ted Nelson's ideas, since it was based on textual markup (HTML derived from SGML, Standard Generalized Markup Language). The browser follows the markup in the text documents, so.. this is that hypertext...
  • Reply 16 of 21
    tzeshantzeshan Posts: 1,886member
    What is the best age for young kids to learn?  What kind of preparations they need to have?  
  • Reply 17 of 21
    macplusplusmacplusplus Posts: 1,604member
    The relationship of HyperCard to Interface Builder as claimed in the article is not something I remember from those years. If Interface Builder needs something to be inspired from, this is rather ResEdit, not HyperCard.
    edited June 2016 jpellino
  • Reply 18 of 21
    dick applebaumdick applebaum Posts: 12,505member

    Based on what I've learned so far, it appears that it would be relatively easy to implement "HyperCard" using the Swift Playgrounds iPad app -- the converse is not true.

    And, it might be worth the effort -- HyperSwift would provide an even higher level of abstraction for people who don't want to learn programming, per se.

    Apple considers Swift to be everything from a scripting language to a system programming language -- HyperSwift, additionally, could be used as a replacement for AppleScript.



    edited June 2016
  • Reply 19 of 21
    jpellinojpellino Posts: 611member
    Good article!

    But, I think you give too much credit to HyperCard for influencing development of the web.  Ted Nelson coined the word HyperText in 1965 -- gave lectures and published books on the subject -- before the Mac or NeXT even existed.  I suspect that both Bill Atkinson and Tim Berners-Lee were influenced by Ted Nelson.

    I dunno - I have Ted's book/s and in spite of the interactive nature of the binding, tap it as I may, nothing happens.Bill made a product that carried the concept out in something anyone could understand  I got more actual working solutions out of students with HyperCard than with anything before it.  Tim also made something tangible from the concept.  If you're going to invoke Ted, then you also have to acknowledge Vannevar Bush.  Theres a lot of "begats" in this chain.  
  • Reply 20 of 21
    volcanvolcan Posts: 1,770member
    Since Swift is apparently the new direction that Apple is heading, I wonder what progress is being made on converting the API libraries to Swift. That is one massive legacy code base. Just renewed my developer membership yesterday for like the fifteenth year. Yet to develop an app although I still have the $500 t-shirt. I  code.
    edited June 2016
Sign In or Register to comment.