Giter VIP home page Giter VIP logo

shyamalschandra / microbit-swift-playgrounds Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microbit-foundation/microbit-swift-playgrounds

0.0 1.0 0.0 45.57 MB

We've built a Swift Playground that lets you program the micro:bit. This also includes a Swift API for interacting with the micro:bit.

Home Page: https://microbit.org/guide/swift-playgrounds/

License: Other

Swift 95.66% Shell 0.20% HTML 0.41% JavaScript 3.73%

microbit-swift-playgrounds's Introduction

micro:bit Swift Playgrounds

Overview

This document covers how to use the BBC micro:bit template book to create your own Swift Playground book. It does not include details on the format of the playground books or the markup of the Content.swift files.

The term Swift Playground can have different meanings. When we refer to a Swift Playground we mean a Swift Playground Book. The book format allows for the creation of chapters and pages such that it is structured in a book format.

For a complete description of the Swift Playground book format please refer to the Apple documentation. You should familiarise yourself with this documentation before attempting to create your own book.

The micro:bit Template Book

Creating a Swift Playground from scratch is a complex programming task. By providing a template book we have written all the complex code required to pair and communicate with the micro:bit over Bluetooth. You can think of the template book as providing a Playground SDK (Software Development Kit).

The template book is provided in this repository as micro-bit template.playgroundbook

After cloning this folder, you should rename it to something appropriate but keep the extension .playgroundbook

On a Mac OS computer this will appear as a file bundle which means it appears as a single file but is actually a directory structure. To open the directory structure, you need to select the book and choose Show Package Contents from the Finder's contextual menu.

To edit the book you will ideally require a tool suitable for editing Swift and plist files. We would recommend downloading Xcode from the Apple App Store.

The files you need to edit are located in Contents/Chapters/ You will also need to edit the appropriate manifest.plist files. Refer to the Apple documentation on details of this.

Inside the Contents/Sources directory you will find all the source files required for the playground to communicate with the micro:bit as well as a host of other supporting functionality. These may also provide an additional insight into the functionality of our Swift Playground SDK.

Testing Your Book

To test your book you can either:

  • Copy it to the Playgrounds folder in your iCloud drive. The Swift Playgrounds app on your iPad will notice it has been added/updated and download it accordingly.
  • Airdrop the playground book from the Finder to your iPad, then respond accordingly on the iPad. This is fine the first time you copy the book but subsequent drops will make copies of the book which will build-up over time and need to be deleted.
  • Utilise a script file as detailed below or author an Automator action.

The Apple documentation also lists various ways of getting your playground onto a device.

The micro:bit API Book

This repository also contains another Swift Playground book called microbit API.playgroundbook

This playground provides an interactive demonstration of the whole of the API we have defined for interacting with the micro:bit much of which is not included in the Intro book. You may wish to install this to your iPad and explore it before developing your own book as it will illustrate the many possibilites that are possible from the Swift Playgrounds app.

Using Script Files

The repository also contains three script files:

  • create_doc_book.sh
  • create_intro_book.sh
  • create_template_book.sh

These were used by us to the create the micro:bit API, Intro to the BBC micro:bit and micro-bit template playground books. These scripts copy and compile the micro-bit source book and then merge the books' contents from separate folders. You may wish to copy and modify one of these scripts for your own workflow. They contain lines to compile the original storyboard and assets from the source book. Unless you intend to modify the storyboard or assets then you should just work from the compiled template book instead.

microbit-swift-playgrounds's People

Contributors

gary-atkinson avatar microbit-mark avatar jaustin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.