applitude: Elegant DSL to create iPhone apps in Eclipse
While language purists might balk at the growing popularity of projects that compile to Objective-C, the verbosity of the Cocoa framework has many developers looking for a faster way to create iPhone apps. Let’s face it, the vast majority of apps in the App Store follow a familiar pattern of making a network request, showing an activity indicator, parsing a JSON response, handling errors, loading a UITableView
, and handling navigation to the next bit of data.
Applitude is based on Applause, a nifty Domain Specific Language from Heiko Behrens and Peter Friese based on Xtext for creating iOS apps. Ralf Ebert has pared down Applause to have an iPhone focus to create Applitude. Here’s a sample:
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
}
}
}
This example creates a simple demo app based on some JSON:
[
{
"name" : "Thomas Edison",
"imageUrl" : "http://applitude.org/demo/edison.jpg",
"inventions" : [
{ "name" : "Light bulb" },
{ "name" : "Motion picture" },
{ "name" : "Phonograph" }
]
},
{
"name" : "Alexander Graham Bell",
"imageUrl" : "http://applitude.org/demo/bell.jpg",
"inventions" : [
{ "name" : "Telephone" }
]
},
{
"name" : "Nikola Tesla",
"imageUrl" : "http://applitude.org/demo/tesla.jpg",
"inventions" : [
{ "name" : "Tesla coil" },
{ "name" : "Alternating current" }
]
}
]
Applitude bundles popular open source iOS frameworks including TouchJSON, TouchXML, and ASIHTTPRequest. Visit the project home page for advanced usage, requirements, and installation instructions
Discussion
Sign in or Join to comment or subscribe