Apple’s Swift Playgrounds app - a free iPad learning app now supports robots, drones and toys control - Hawkdive

Friday, July 14, 2017

Apple’s Swift Playgrounds app - a free iPad learning app now supports robots, drones and toys control

A definitive guide on Apple's Swift Playgrounds - A free iPad app that changes your kids life

Isn't it impressive if your kids hover a drone 5 feet above the lawn with the help of an iPad app using his own programming code and he makes the drone roll and backflip, yaw and pitch, take off and land. This all can be done using Apple's new iPad app called "Swift Playgrounds" which helps kids learn to code through games and develop apps for Mac, iPhone, iPad, Apple TV or Apple Watch while having fun at the same time. Swift Playgrounds is a free learning app available only for iPads as of writing. It is based on Apple's new coding language -Swift, which was released in 2014. Swift is known for its powerful, flexible and very easy to learn interface. Over 250,000 apps in the App Store has already been written in this Swift Language. With its growing popularity and Apple's ambition to make it the next generation language, Apple introduced "Swift Playgrounds" app in 2016 and rolled out a major update to this app in June 2017 to support toys, robots, drones and musical instruments. Which means that the new Swift Playgrounds version 1.5 controls a variety of Bluetooth-enabled drones, robots, musical instruments and other hardware accessories. You can customize their behavior and ask them to do anything you want. Read this descriptive guide to know everything about Swift Playgrounds App and the robots and drones it supports.

What is Swift Language and its significance?

Swift is a robust and intuitive general-purpose programming language created by Apple for building apps for iOS, Mac, Apple TV and Apple Watch. It adopts safe programming patterns and robust features from other popular languages such as Objective C, Haskel, Ruby, Python, Rust and CLU and it adds modern features to make programming easier, more flexible, and more fun. With its open source and user friendly syntax that is a joy to use - Swift has become the easiest expressive language that anyone with an idea can create something incredible.
Learning Swift with Swift Playgrounds - a free iPad learning app
Learning Swift with Swift Playgrounds - a free iPad learning app
Swift is the future of iOS app development. With its powerful open source and a big developer community it lets everyone build amazing apps. Most importantly, Swift is designed to help developers writing and maintaining correct programs easily.  If you are already learning Objective-C then you can read this tutorial on comparison between Objective-C and Swift which will help you in transitioning. For your quick reference, I have included a few sample of basic coding below from Apple's free ebook - The Swift Programming Language(ePub) that you can download on your iPhone, iPad, iPod or Mac to learn more about this language.

Swift support almost all "Standard C" operator, here are few example:
String concatenation code:
"hello, " + "world"  // equals "hello, world"

Comparison Operators:
Equal to (a == b)
Not equal to (a != b)
Greater than (a > b)
Less than (a < b)
Greater than or equal to (a >= b)
Less than or equal to (a <= b)
Conditional statements, such as the if statement:
let name = "world"
if name == "world" {
    print("hello, world")
} else {
    print("I'm sorry \(name), but I don't recognize you")
}
// Prints "hello, world", because name is indeed equal to "world".

After looking at its growing popularity and robust features following popular universities are incorporating Swift into their courses:
  • Aberystwyth University
  • California Polytechnic State University
  • Cuesta College
  • Drexel University
  • Full Sail University
  • Ingésup
  • Northwest Kansas Technical College
  • Plymouth University
  • RMIT University
  • Southern Methodist University
  • Stanford University
  • Technical University of Munich
  • Tecnológico de Monterrey
  • University of California, Santa Cruz
Over quarter of a million apps in the App Store has been built with swift. Following are some famous app developed in Swift.
  • Lyft
  • Khan Academy
  • Clear
  • Sky Guide
  • LinkedIn
  • Airbnb
  • Eventbrite
  • Hipmunk

What is Swift Playgrounds App? Who can use it?

Swift Playgrounds is a free revolutionary app for iPad developed by Apple to help learn to code and experiment in Swift language. It has basic " Learn to Code lessons" which include interactive puzzles and exercises to master the basics of coding while additional challenges and free app templates let you create real engaging and unique apps. Beyond these tutorials, you can write programs that interact with iPad technology, such as microphone, touch display, the built-in camera, accelerometer, location services, bluetooth and much more.

The best thing about Swift Playgrounds app is "it requires no coding knowledge, so it’s perfect for beginners that it could be anyone's first programming language on Swift playgrounds. Apple's idea behind playgrounds app is to engage kids in a fun activity which also teaches them to explore key coding concepts using real code. What it means is that kids not only can tap around on a touchscreen to move virtual characters but also can write a program and use the touchscreen to control a variety of Bluetooth-enabled robots and toys right within the Swift Playgrounds app. The screen is split in two parts- left and right. You type the code on the left and see the results on the right — with just a tap.
Swift Playground App now supports Robots, Drones and Toys Control for learning
Swift Playground App now supports Robots, Drones and Toys Control for learning
Programming has never been such an easier task and Swift Playgrounds is going to change the way we learn to code, and because it uses less coding syntax and verbose than other languages and promise a smoother transition from ideas to app - it's going to be a revolutionary first-of-its-kind learning app.
It doesn't have any age requirement or suggestion for use so anyone with an iPad can use it. Kids can use it to learn basics of coding and think programmatically in an interactive environment while the advance learners like teachers, parents and other prospective coders can use Swift Playgrounds to enhance their skill using the additional challenges and templates. The app also offers suggestion and corrects you when you get something wrong so it's safe and there is no failure. I can't wait to say that this is going to be a game changer as the App being on an iPad can be used anywhere anytime, you don't need to sit in a chair or around a computer screen all day.

How can I install Swift Playgrounds on my iPad?

In order to install the Playgrounds app on your iPad you need to make sure you are running iOS version 10 and above.
  • Press the home button on your iPad and tap on Settings.
  • Tap General and select About.
  • Note the number next to version: this is the iOS version installed on your iPad.
  • You can also find the iOS version in iTunes on your computer when you connect the iPad to the computer.
Swift Playgrounds is a free standalone app that you can download from the App Store on your iPad.
  • You can open the App Store and search for it by its name or simply click the link to - download Swift Playgrounds on iPad.
  • Type your Apple ID and password and the hit install.
  • Once it's installed you can find it in home screen.

Features of Swift Playgrounds

The main reason behind its popularity is the feature that it offers. Following are some major features of this App that will make you download and try it.
  1. Built-in lessons created by Apple that guide you through the basics to advance concepts of programming.
    Learning Swift With Swift Playgrounds App
    Learning Swift With Swift Playgrounds App
  2. You can watch your code run in interactive 3D world that you can rotate with a finger and pinch to zoom.
  3. As you move further in the process of completing challenges you keep unlocking next level and new challenges keeps getting added by Apple to keep improving your coding skills.
  4. Moving any command and changing its order is simple - just tap on the command and hold it to grab and move the finger to place it at a different location.
  5. Your code can directly access iPad hardware such as speaker, microphone, camera, accelerometer, bluetooth and touch screen events.
  6. Share your work with your friends and family using Messages, Mail, AirDrop, or other Sharing options.
  7. If you find a command hard to understand, simply touch and hold it to see the option with description. 
    Coding help in Swift Playgrounds App
    Coding help in Swift Playgrounds App
  8. It's also available in Simplified Chinese, Japanese, French, German and Latin American Spanish.
The small programs that you create in the App is called “playgrounds". There are hundreds of sample templates and playgrounds available for different kind of task and app creation, you can easily modify and change them as per your needs. The new Swift Playgrounds version 1.5 has got some playgrounds(Small Programs) that use Bluetooth to control drones, robots, musical instruments and other hardware accessories. Such different playgrounds are available in accessories and also called accessories Playgrounds. Using these accessories playgrounds you can code to command Lego Mindstorms EV3 robots and make Sphero SPRK+ robot move around the room, take off and land a Parrot drone, or teach a Dash robot to sing and dance. Apple also demonstrated controlling some of these robot and drones using Swift Playgrounds on iPad during this WWDC 2017 event. 

How to use Swift Playgrounds: Coding to control robots and drones

In Swift Playgrounds app you can start with basic learning lessons like - Fundamentals of Swift, Beyond the Basics and Explore the universe. Then move onto puzzles and advance challenges gradually. You need to download each courses and puzzles to learn and work with them. Once the lesson or puzzle is finished downloading, tap on Open or go to My Playgrounds to locate it. Once you have finished reading and learning the lessons you can then switch to the main programming interface where left screen shows the instructions and code and right side of the screen can show the results of the code when executed.
In Swift Playgrounds, you will choose a 3D animated character called "Byte". Byte will love to move, jump and collect gems. Follow the simple steps below to open the main programming interface.
Bytes Characters in Swift Playgrounds App
Bytes Characters in Swift Playgrounds App
  • Open the Swift Playgrounds app and tap on the add + button at the top left of the screen.
  • Tap on Create Playground or choose one of the available templates.
  • Start writing Swift code on the left.
  • Once you are done, tap the Run My Code button to execute it.
  • As you continue through the challenges, the next level and coding become more complex.
In order to command and control a robot, drone or any musical instruments, you need to download its respective accessories playgrounds. Here is how you can load the accessories playgrounds of a drone or robots.
  • Open the Swift Playgrounds app and tap on the Accessories at the bottom.
  • Select the accessories playground for the hardware you want to connect and code with.
    Apple’s Swift Playgrounds - a free iPad learning app now supports robots, drones and toys control
    Apple’s Swift Playgrounds - a free iPad learning app now supports robots, drones and toys control
  • Tap on get to download the accessories you want. For example, in the picture shown above I have selected Dash robot's Accessories Playgrounds (Guided Lesson and Dash Template) to download so that I can connect my Dash robot by Wonder Workshop and code to command it.
  • Once its finished downloading select the Dash template to open and follow the simple steps to start writing code on the left.
    Controlling a Wonder Workshop's Dash robot using Swift Playgrounds
    Controlling a Wonder Workshop's Dash robot using Swift Playgrounds
  • This template will automatically detect any robots or drones in the range that it supports. 
  • When you start a function you will find a list of all the command you can use with it, along the bottom edge.
  • Now using function and command you can make the robot speak, sing, and dance.
Swift Playgrounds currently includes accessories playgrounds for almost all the robots and drones it supports. Each accessory has its guided lessons and templates- Guided lessons are to teach you some basics features, command and code for the respective accessories and the template will be used to write your own programs that control the respective device.

Some Swift Playgrounds Toys and the stunt they perform:

1. LEGO MINDSTORMS EV3 :- You can create five different robots from just one set simply by applying certain code to specific motors and sensors. It can become a tracker, Gripper, Reptar (Strikes at incredible, cobra-like speed with its fearsome fangs) and Spiker (a Six-legged creature with a lightning tail).
LEGO MINDSTORMS EV3
LEGO MINDSTORMS EV3
You can click on the image to buy it from Amazon which will cost you around 349.95 USD.

2. Sphero SPRK+ :-  It costs 130 USD from Apple and will cost 120 USD from Amazon. It's an App controlled robotic ball with a waterproof and scratch resistant polycarbonate shell. It can light up, change color, accelerates, and rolls around on command. With Playgrounds, you can make it dance, change color or Swim across the water with your coding.
Sphero SPRK+ now gets controlled in Swift Playgrounds
Sphero SPRK+ now gets controlled in Swift Playgrounds
3. Parrot Minidrone Mambo:- Parrot's Minidrone Mambo can fire miniature balls at moving objects and you can acrobatic tricks such as flips and barrel rolls. Using the Swift code on your Playgrounds you can make it take off and land. It also sense the motion of iPad like tilting the iPad will prompt the drone to go up. It costs $110 from Apple but Amazon is offering it for $96.89 as of writing.
Control Parrot's Minidrone Mambo using your iPad
Control Parrot's Minidrone Mambo using your iPad
4. Dash by Wonder Workshop:- Unlike other robotics products it doesn't need hours of assembly, it comes pre-assembled and ready to play. It can be used with Wonder App on iOS and Android both. It offers your child more than 600 built-in activities, and challenge tutorials which will teach them how to make this robot speak, sing and run into something in front or in back of it. Apple is selling it for $149.95 while Amazon charges you only $132.
Make the Dash robot dance using iPad app Swift Playgrounds
Make the Dash robot dance using iPad app Swift Playgrounds
You can also visit Apple's accessories shoopping cart to check out these robots and drones.

Some free resources to learn and excel in Swift Programming

Almost every compatible drones and robots comes with their learning resources like lessons and challenge activities that can be downloaded right from the Swift Playgrounds app. For more information and learning new tips and tricks on Sphero Robot, you can also download their educational app at https://edu.sphero.com/ and a similar education app from Wonder Workshop at https://education.makewonder.com/.
To start with Swift Playgrounds, Apple has also created a free guide called Swift Playgrounds downloadable from iTunes and iBooks Store. It's designed for teachers to use in middle school and above. Each chapter comes with an activity to practice with children in the classroom.
Some other free online resources to learn Swift programming are following:
https://www.tutorialspoint.com/swift/
https://www.codeschool.com/courses/app-evolution-with-swift
http://www.learnswift.tips/
As we already know that more than quarter a billion apps including some of the most popular in the App Store, use Swift. With a significant number of Playgrounds users and support to robots, drones and toys, Swift is becoming popular. Getting an iPad to teach your kids Swift language with fun using robots and drone is no doubt little expensive but its also the best way to learn Swift Programming language. Since the launch of Playgrounds app, Apple has partnered with hundreds of educational institutions around the country to get Swift included into their main course curriculums. Apple is partnering with more toys and robotics companies to expand its user base.And with that I can definetely say that Swift Program and Playgrounds App is a part of Apple's $200 bn dream. If you are already using Swift Playgrounds on your iPad, do let me know about your experiences and challenges in the comment section below.

*******End of Article********

1 comment:

  1. I am already using Playgrounds..but thanks for sharing the useful resource links

    ReplyDelete