Some example code files in Ruby, Javascript (ES6), and Swift
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Swift for Ruby and JS Developers

Some example code files that implement the same functionality in Ruby, Javascript (ES6), and Swift.

(Supports this presentation which you can see for context.)

There are three different examples: Basic, Objects, and Mixins. If you execute all 3 examples in the different languages, the output should be virtually identical.


Ruby examples require at least Ruby 2.0

Javascript examples require at least ES6 (the most recent versions of Safari or Chrome should suffice).

Swift examples require Swift 3 (provided by the latest versions of XCode). You can run the .swift files directly or load the full playground up in XCode and run that.

One cool way to run all the different examples is to use the Script add-on package for the Atom code editor.


Some of these examples are pretty basic/silly, so I'd love to see some additional/better examples added so we can have a really solid set of comparisons between Swift, Ruby, and JS. I welcome all pull requests and feedback!

–Jared White