You’re not using ARC

ARC (Automatic Reference Counting) is a great addition to Objective-C, allowing for the automatic release of objects after they are no longer being used. After having come to Objective-C from C# earlier this year it seemed completely natural to me for it to be there; memory management had always been very good in .Net so I came with the expectation that the compiler would worry about memory management for me. This meant that when I learned Objective-C, I got completely used to using ARC.

But am I using ARC? I wasn’t writing any extra code that I wouldn’t have written normally. I’m not thinking any differently. ARC has effectively become so embedded into Objective-C that I would argue that now it seems like you’re using ‘extras’ when writing code with old school memory management.

When browsing for arguments for not using ARC I found that generally the consensus was that ARC does everything you could possibly need it to do (‘Use it. Do it today’) and the only real reason to not use it is if you are perfectly capable of writing good ‘old school’ code or if you need to support two/three year old versions of iOS/OSX. Even then, the suggestion was that you are only going to write better code if you use ARC.

I struggled to find any other strong arguments for not using ARC, because of the simplicity that it brings to Objective-C. One suggestion was that it would make older code harder to maintain, but at the end of the day it doesn’t – I have written code that integrates absolutely fine into my existing code because I can just set Xcode not to use ARC on specific files.

Ultimately I think that because ARC is such a standard thing to ‘use’ now we shouldn’t think that we are ‘using’ it any more. It should be accepted as a component of Objective-C rather than thinking of it as an ‘extra’ feature (even though, technically it is an addition Apple made to Clang).

N.B: ARC is great for learning and also terrible for learning. It is great because it makes Objective-C a hell of a lot easier to learn and if you are a beginner it makes code in general a lot simpler to understand. On the other hand, it is awful because it doesn’t teach memory management or garbage collection at all. Developers should have an understanding of where their objects are at any point in the event loop, and by having all of the release and retain calls in your code it is a lot easier to understand, but in theory ARC should mean that you don’t have to understand it anymore.


Using GLKit to do super simple antialiasing

I’ve been doing some work with OpenGL ES recently and I was getting irritated that lines produced tended to have very jagged edges. After exploring for a while I discovered that iOS has supported multi-sampling since iOS 4 however it takes quite a lot of code which I didn’t really fancy having to implement, especially because I was already using GLKit and therefore not using render or frame buffers. I didn’t want to have to blur line edges either, I just wanted full screen antialiasing.
It turns out that iOS 5 and above support antialiasing if you are using a GLKView:

GLKView *glkView = (GLKView*)self.view;
glkView.drawableMultisample = GLKViewDrawableMultisample4X;

Incredibly I didn’t detect any performance lag – I can quite happily achieve 60fps on a retina device with 100,000 triangles!

Christmas backgrounds in Keep Calm

Today I have issued an update to Keep Calm Creator for iOS that allows you to optionally purchase 15 Christmas themed backgrounds to get your posters ready for the holiday season. I’ve also updated the iPad UI so now the app not only runs significantly faster it also looks a lot better as well. Rather than having to swipe across the whole screen, you can now view all your posters in a grid.

Other than that the app hasn’t really had too much added to it in this version. All of the background images are CC3 licensed so here is a gallery preview of all 15:

The images were originally produced by the following:

If you’ve got any good Christmas pictures that you wouldn’t mind seeing in the app feel free to contact me although any update will not be approved by Christmas sadly :(, however you could submit posters you make to my Keep Calm blog.