Tag Archives: xcode

Quick thoughts on Xcode and Objective C versus Microsoft’s tools

I have been trying out JetBrains’ AppCode which meant working in an Apple development environment for a time. I took the opportunity to implement my simple calculator app in iOS native code.


Objective C is a distinctive language with a mixed reputation, but I enjoy coding with it. I used Automatic Reference Counting (ARC), a feature introduced in Xcode 4.2 and OSX 10.7, iOS 5; ARC now also works with 10.6 and iOS 4. This means objects are automatically disposed, and I did not have to worry about memory management at all in my simple app. This is not a complete memory management solution (if there is such a thing) – if you use malloc you must use free – but it meant that the code in my app is not particularly verbose or complex compared to other languages. Apple’s libraries seem to favour plain English method names like StringByAppendingString which makes for readable code.

I was impressed by how easy it is to make an app that looks good, because the controls are beautifully designed. I understand the attraction of developing solely for Apple’s platform.

I also love the integrated source control in Xcode. You find yourself using a local Git repository almost without thinking about it. Microsoft could learn from that; no need for Team Foundation Server for a solo developer.

I did miss namespaces. In Objective C, if you want to remove the risk of name collision with a library, you have to use your own class prefix (and hope that nobody else picked the same one).


Interface Builder, the visual UI designer, is great but many developers do not use it, because coding the UI without it is more flexible. It is a shame that you have to make this choice, unlike IDE’s with “two way tools” that let you edit in code or visually and seamlessly keep the two in synch. I found myself constantly having to re-display windows like the Attributes Inspector though it is not too bad once you learn the keyboard shortcuts. The latest Interface Builder has a storyboard feature which lets you define several screens and link them. It looks useful, though when I played with this I found it difficult to follow all the linking lines the designer drew for me.

It is interesting to compare the Mac and iOS development platform with that for Windows. Microsoft promotes the idea of language choice, though most professional development is either C# or C++, whereas on Apple’s platform it is Objective C and Cocoa or you are on your own. Although Mac and Windows are of a similar age, Microsoft’s platform gives a GUI developer more choices: Win32, MFC, WTL, Windows Forms, Windows Presentation Foundation and Silverlight, and in Windows 8 the new WinRT.

I get the impression that Microsoft is envious of this single-minded approach and trying to bring it to Metro-style Windows 8, where you still have a choice of languages but really only one GUI framework.

That said, Visual Studio is an impressive tool and both C# and C++ have important features which are lacking in Objective C. I would judge that Visual Studio is the more productive tool overall, but Apple’s developer platform has its own attractions.

Review: JetBrains AppCode for Objective C

I have been trying out JetBrains AppCode, a new IDE for Apple’s Objective C. The company is best known for its IntelliJ IDE for Java, and AppCode essentially takes the same core IDE and reworks it for Objective C. AppCode is itself a Java application, but unless you have a religious objection to this I doubt you will find it a problem: I found it perfectly snappy and responsive on my machine, a 2.3 Ghz Core i5 with 8GB RAM.

Installation was a snap, as Mac users expect.


One thing I discovered immediately is that AppCode is not a replacement for Xcode, the official Apple IDE. The Apple SDKs are delivered with Xcode, and AppCode requires it. An AppCode project is also an Xcode project.


This is particularly important if you want to use Interface Builder, the Xcode visual designer, since AppCode has no equivalent. Double-click the .xib file and it opens in Xcode. This is a disorientating at first, but in practice I found it convenient to be able to switch between the two IDEs.

So why bother with AppCode, when Xcode is free? It is certainly not essential, but my view is that tools which save time or improve quality are worth the investment. Whether AppCode will do this for you will depend on how you work and whether you have any frustrations with Xcode, which improved considerably in version 4. Out of the box, Xcode has integrated Git or Subversion source code control, unit test integration, refactoring including Rename, Extract, and Encapsulate, the aforementioned Interface Builder, and a ton of other features. Sticking with Xcode is a safe choice.

That said, AppCode feels leaner and less cluttered than Xcode. It also has many additional productivity features in the editor. JetBrains’ IDEs are well known for refactoring, and while AppCode is not as rich as IntelliJ IDEA in this respect, it does have a more than Xcode.

Another strong feature is code generation. Press Command + n in the editor, and a context-sensitive Generate menu offers various time-saving options. I like the way I can type a new method in an implementation file, press Alt + Enter, and select Declare method in the interface to add it automatically to the interface file; or type it first in the interface and have it implemented automatically. It pays to learn the keyboard shortcuts

Live templates let you type an abbreviation and expand it to a block of code, which you then tab through to edit. Type for, select the template, press tab, and AppCode will create a for loop; press tab again to edit the variable name and the number of iterations. You can customise and create your own Live templates in the AppCode Preferences dialog.


There are also a ton of performance tools in AppCode [update: note these are links to Xcode tools].  Choose Profile from the Run menu and choose what you want to analyse:


then run your app


You can also do static analysis according to customisable rules.

There is a debugger which works as you would expect including stack trace and variable inspection.

The best thing I can say about AppCode is that it is a pleasure to use. It does not throw up unnecessary dialogs, it works logically, and the tools are easy to use and configure. I have not always found this to be the case with Xcode, and if you spend a significant amount of your time on Objective C development then I recommend grabbing the trial download to discover if it will speed your work.

Post sponsored by Monster for the best in IT Jobs.

Building PasswordSafe for the Mac: Lion development hassles

I am doing some work on a Mac at the moment. On Windows I store passwords in PasswordSafe, an open source utility that works well, so I wondered if I could access my PasswordSafe database from the Mac.


I could have run the Windows version in Parallels, which I have just installed, but I figured a Mac version would be more convenient. I didn’t see a Mac build among the downloads, but PasswordSafe is cross-platform, so I downloaded the source to do a quick compile.

I was glad to find README.MAC.DEVELOPERS.txt in the PasswordSafe source and set to work. The first task is to download wxWidgets, a cross-platform GUI library, so I went off to download that. Ran the osx-build-wx script as instructed. Result: error message stating C compiler cannot create executables.

The problem seems to be that PasswordSafe expects GCC 4.0 but the latest Xcode installs GCC 4.2. The solution suggested here is to remove Xcode 4, install Xcode 3, and then reinstate Xcode 4. There are related issues concerning PPC fat binaries and older versions of the Mac SDK.

That solution seemed risky and ardous to me, and I remembered that I still had an old Mac Mini from which I was forced to upgrade in order to install Lion, the latest OS X. I hooked it up, removed Xcode 4, installed Xcode 3, and set to work again.

I get the impression not many people build PasswordSafe for the Mac. The first issue I discovered was that the steps in in the README.MAC.DEVELOPERS.txt don’t mention that after running osx-build-wx you also have to run make in order to build static libraries. That was easy though. The next thing is to load the supplied PasswordSafe project into Xcode and build.

I did that but got an error – the linker could not resolve SizeRestrictedPanel. The fix was to add SizeRestrictedPanel.cpp and SizeRestrictedPanel.h to the project. PasswordSafe then built and seems to work fine, on Lion as well as earlier versions of OS X, though there are a few cosmetic issues. You can see from the image that the caption for the New Database button is slightly awry.

If anyone wants my build, it is here. There is also a Java version, and some people have success with that on the Mac.

JetBrains announces IDE for Objective C to compete with Xcode

JetBrains, maker of the admired IntelliJ IDEA Java IDE, has announced CIDR, an IDE for Objective C.

The 10 facts in the initial post tell us that it will be Intel Mac only, will open and create Xcode projects, and integrates with the standard interface builder and with the iOS simulator.

Xcode is decent so what is the point? Mainly I guess because of the refactoring and productivity tools JetBrains builds into its tools. W are promised refactories, on the fly code analysis, and code completion.

I am sure it will be worth a look, though taking on Apple will not be easy; it is a bit like going up against Microsoft’s Visual Studio n Windows, except that Xcode is free.

That said, it does not take much in terms of added productivity to pay back the cost of an IDE.