📜 ⬆️ ⬇️

Swift Playgrounds 1.5. Programming Sphero and more.

Today, for all people interested in Apple products, was the day of the beginning of WWDC17, which presents many interesting things, such as iOS 11, MacOS High Sierra and others. But I waited on June 5th not only because of this. I was waiting for the new version of Swift Playgrounds and it came out!

What is Swift Playgrounds?

As Apple itself writes: “Swift Playgrounds is a revolutionary app for the iPad.” Indeed, simple interactive examples that even children can understand are explained the basics of programming using the Swift language.

The user works in the so-called "sandbox" - playground, hence the name.
')
What does the Swift Playgrounds look like?

The new version has been redesigned application. Now when you start you get to the main menu. It is designed like many Apple applications in the form of a “bookshelf”.



When you click on the element “Get PlayGround” - we find ourselves in a small shop of various sandboxes. What is important - they are all free . All sandboxes are divided into several types:



Currently, all sandboxes use Swift version 3.1.

Accessories - the main novelty

It must be said that even before this update, sandboxes could be found on the Internet for interacting with external devices. And indeed, if Apple is positioning this application for teaching children, then there is nothing better than a visual application. But all these sandboxes left much to be desired. There were difficulties with their loading and connecting external devices. Let's see what Apple will offer us, using the example of working with the Sphero robot.

Sphero & Swift

There are two sandboxes available for Sphero - Sphero Arcade and Sphero Template. Let's start with the first one.



Everything is very simple, when you first start it tells you what this course will teach us, and then the usual lessons start.

It tells how to connect, describes the simplest commands, offers puzzles.



The following features are considered:


After that, it is proposed to create Ping-Pong, where Sphero is used as a ball.

As for the Sphero Template, it’s just a template where all the functions for working with the robot are defined. In addition, in a separate part of the screen the real characteristics of the robot at the moment are displayed: speed, angle, accelerometer and gyroscope readings.



Given that you can now interact with:


Swift Playgrounds becomes really interesting and can be used for various interactive classes and workshops. A small but tangible disadvantage is the lack of Russian localization.

Source: https://habr.com/ru/post/330288/


All Articles