This is an example application created in order to show how you can write a simple iOS app that connects to an external API and displays downloaded JSON data. It connects to a demo installation of RubyTime, our time tracking system, and displays a list of projects and each project's activities.
AppDelegate
– the entry point to the app; creates a window, main view controller, shows a login form popupLoginViewController
– asks the user for username and password and then sends them to the server to check if they're correctMasterViewController
– loads all projects from the API and displays them on the listDetailViewController
– loads a selected project's activities from the API and displays themServerConnector
– a shared singleton object that handles all connections to the API and returns data to view controllersActivity
,Project
– model objects built from JSON hashes downloaded from the API
Some non-standard things you might see that come from LunarToolkit (basically anything that starts with "LL" comes from there):
LLArray
– this is a macro that saves you some typing while creating an arrayLLFormat
– a macro which simplifies creating strings, works just likeprintf
LLReleaseOnDealloc
– a macro that lets you write a dealloc method that releases 4 objects in 1 line instead of 7LLAccount
– lets you store a username and password, save them into settings and load them backLLConnector
– simplifies building network connection classes like ServerConnectorllWrapInNavigationController
– returns a new UINavigationController having given controller at the root of the stackllShowErrorWithMessage
– show a UIAlertView with title "Error" and given message
Copyright by Jakub Suder <jakub.suder at gmail.com> & Lunar Logic Polska. Licensed under WTFPL license.
This app uses ASIHTTPRequest by Ben Copsey for making network connections, JSONKit by John Engelhart for JSON parsing, SFHFKeychainUtils by Buzz Andersen to store user's credentials, and our own library LunarToolkit to make various things easier.