Developing for the iPhone can be a very rewarding experience as the Software Development Kit (SDK) and range of development tools which Apple provide are extremely comprehensive.
The following are the main tools which I use when developing for the iPhone:
Xcode – This is the Integrated Development Environment (IDE) where the all the code is written.
iPhone SDK – Provides the framework for building the iPhone applications through a wide range of classes provided from Apple through the Objective-C programming language.
Simulator – Enables you to compile and test code locally on your machine.
Interface builder – Enables you to add the graphical elements to you application and hook them up to your code using the MVC design pattern.
Instruments – Allows you to analyse your application code for memory leaks and ensures your code will give the best possible response time on the device.
One of the most interesting things about developing for the iPhone is working out how achieving various tasks can be approached. In a project I was working on recently I was presented with the task of implementing maps which would provide directions to an end point based on a certain set of parameters.
In a lot of development environments this would be an extremely difficult task which would involve implementing a form of custom pathfinding algorithm which is not easy and can take a long time to fully test and implement.
Google have created an API (Application Programming Interface) that has been designed in order to enable developers to embed Google Maps on web pages and customise these in a variety of ways such as adding locations, street views, directions in addition to much more. This is important as it means that when combined with an Objective-C Webview in the iPhone SDK we can harness the resources of the Google Maps API in this particular case directions in order to for the pathfinding to take place on the map.
If we were not able to integrate with these new technologies on the iPhone it would mean that we would have to design an algorithm in order to deal with the directions, this can be quite a complex task and will add a lot of extra cost to the development in terms of planning, design and development time. This could potentially be achieved by using a method such as the Dijkstra Algorithm in order to work out the shortest paths between two points based on a wide range of rules.
The Google Maps API makes this very simple:
The following example has been taken from the Google Maps API documentation and is JS (JavaScript) based code which will be implemented through an Objective-C based Webveiew.
//-------------------------------------------------------------------------------
// Create a directions object and register a map and DIV to hold the
// resulting computed directions
var map;
var directionsPanel;
var directions;
function initialize() {
map = new GMap2(document.getElementById("map_canvas"));
directionsPanel = document.getElementById("my_textual_div");
map.setCenter(new GLatLng(49.496675,-102.65625), 3);
directions = new GDirections(map, directionsPanel);
directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston,
MA 02215 (Fenway Park)");
}
//-------------------------------------------------------------------------------
From here we can see that we just have to utilise the parameters for the actual address data and pass this into the methods encapsulated in the API. Once this has been achieved Google Maps takes care of the rest so for us, this is a fantastic way to go and enables the rapid development development of applications.
Since working on the iPhone in terms of development, working with a wide range of frameworks is such a strong factor in being able to produce quality applications quickly and making them cost effective for clients.
This was just a high level overview but I just wanted to try and show how technology is progressing in the mobile market and how utilising a wide range of technologies we can rapidly produce applications that do rather complex tasks.
With organisations such as Google producing new APIs on a regular basis I really can’t wait to see what else we can bring to mobile devices in the coming months/years in a manner that will not take developers years to implement through an array of complex custom algorithms for each application.