Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A very basic RubyMotion ASCII DSL to create views

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 resources
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Rakefile
Octocat-spinner-32 Readme.md
Octocat-spinner-32 screenshot.png
Readme.md

RubyMotion Autolayout DSL Demo

This is a very simple RubyMotion app that implements a very basic and generic DSL to create iOS views.

This code...

createViews(%{[label("Welcome")]
              [label("Click on a button!")]
              [image_view("rubymotion")][image_view("rubymotion")][image_view("rubymotion")]
              [button("Say Hi", hi)][button("Say Bye", bye)]})    

… creates this view:

RubyMotion Autolayout Screenshot

How does it work?

createViews is a generic layout method that takes a string like shown above to build a simple UI.

At the moment it simply distributes the available screen real estate evenly to all elements.

It turns "button" into "UIButton", "label" into "UILabel" and "image_view" into "UIImageView"

The first arg in parentheses is the title or the name of a bundled image, the second arg is an action (in case of buttons).

That's it. It's very basic, but I might enhance it in the future.

Something went wrong with that request. Please try again.