Get Updates By E-mail 

Article Written By:
Johann Dowa

Open Source: Generate Objective-C iOS App Code Using A Simple Domain Specific Language

  •  
  •  
  •  
  •  
  •  

I found an interesting project tweeted last night that was created to generate Objective-C code used in iPhone apps coded using a very brief domain specific language (DSL).   Using this project you can very quickly create a project that does things such as download data, parse XML and JSON, and organize that data into a very beautiful looking table view.

What really makes it work is if you have some knowledge of Objective-C coding so that at the end you can tweak the generated code into the exact app your looking for.

Take a look at this image from an app that downloads data, and organizes it all into a nice little app complete with tableviews and toolbars:

Screenshots Inventors demo application

Now look at the code used to generate the Objective-C code for the app:


application Demo {
    view:Tabs()
}

tabview Tabs {
    tab {
        title: "Inventors"
        view: Inventors()
    }
}

type String mapsTo "NSString"

entity Inventor {
    String name
    String imageUrl
    Invention[] inventions
}

entity Invention {
    String name
}

contentprovider AllInventors returns Inventor[] fetches JSON from
    "http://applitude.org/demo/inventors.json" selects ""

tableview Inventors {
    Inventor[] inventors = AllInventors()

    title: "Inventors"

    section {
        cell Default for inventor in inventors {
            text: inventor.name
            image: inventor.imageUrl
            action: InventorDetail(inventor)
        }
    }
}

tableview InventorDetail(Inventor inventor) {
    title: inventor.name
    style: Grouped

    section {
        cell Value2 {
            text: "Name"
            details: inventor.name
        }
    }

    section {
        title: "Inventions"
        cell Default for invention in inventor.inventions {
            text: invention.name
        }
    }

As you can see the code is very brief, and the results are pretty impressive.

You can read more on the project website here:
Applitude
.

The project can be found on Github here:
https://github.com/ralfebert/applitude/

You’ll also want to read up on Xtext to learn how to program using the Applitude DSL:
Xtext Getting Started

The project takes some install to get going, and the author has created an Eclipse plugin that you can use as your ide for the Applitude domain specific language.  Full instructions are on the project website.

This project definitely looks like it could be a major time saver.

Read More: Open Source iOS Libraries And Tools


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments