Skip to content
A very basic RubyMotion ASCII DSL to create views
Find file
New pull request
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore first commit

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...

              [label("Click on a button!")]
              [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.