Archive for 'Programming'


So we trust you can’t possibly have missed so far the impending debut of Automatic Reference Count technology:

Automatic Reference Counting (ARC) for Objective-C makes memory management the job of the compiler. By enabling ARC with the new Apple LLVM compiler, you will never need to type retain or release again, dramatically simplifying the development process, while reducing crashes and memory leaks. The compiler has a complete understanding of your objects, and releases each object the instant it is no longer used, so apps run as fast as ever, with predictable, smooth performance.

Well, that sounds pretty magical, doesn’t it? A little too magical, doesn’t it sound like? Well, whilst we wait for WWDC session videos to show up, here’s some not so light reading for you on the Clang website:

Automatic Reference Counting

The first and primary purpose of this document is to serve as a complete technical specification of Automatic Reference Counting… The secondary purpose is to act as a rationale for why ARC was designed in this way. This should remain tightly focused on the technical design and should not stray into marketing speculation.

Ah, yes. Definitely wouldn’t want to stray into marketing, indeed.

There is also a rather interesting current thread on objc-language you very well may wish to take a read through. Particularly this message:

…The primary advantage of GC over ARC is that it collects retain cycles. A secondary advantage is that “retained” assignments are “atomic” because they are a simple store.

ARC has several big advantages over libauto GC:

1. It has deterministic reclamation of objects (when the last strong reference to the object goes away) where GC frees an object “sometime later”. This defines away a class of subtle bugs that can exist in GC apps that aren’t exposed because the collector doesn’t trigger “in the buggy window”.

2. The high water mark is generally much lower with ARC than GC because objects are released sooner.

3. libauto provides a fragile programming model, you have to be careful to not lose write barriers etc.

4. not all of the system frameworks are GC clean, and the frameworks do occasionally regress as they evolve.

5. ARC doesn’t suffer from false roots. libauto conservatively scans the stack, which means that integers that look like pointers can root object graphs.

6. ARC doesn’t have anything that kicks in and stops your app, causing UI stutters. libauto is pretty advanced as far as GC implementations go because it doesn’t immediately stop every thread, but it still does usually end up stopping all the UI threads.

Yeah, that adds up to a pretty good case for adopting ARC for any project without a 3.x runtime requirement, we’d say. And if like the fellow in the above thread you are a big GC fan, well the comment

I don’t have any comment on GC, other than we continue to support it on Lion.

sure makes it sound like “the writing’s on the wall” to us!


Clang Source Annotations has tips for dealing with annoyingly named annoyances.

Continue Reading →


Ah, nothing quite like slaving away trying to make tomorrow’s promised deliveries to the dulcet background accompaniment of one of those rare Vancouver riots by people who take their hockey way way too seriously. It does add a certain frisson of surreality to the evening, mind you!

But in our regular something new every day news, here’s a handy little piece for if you’d like to make your table cells copyable:

CopyableCell: A UITableViewCell Subclass for Making Cells Copyable

… Sometimes we might want to enable users to copy UITableViewCells’ content. CopyableCell class makes it easy to use a UITableViewCell with copy functionality. It’s a subclass of UITableViewCell class. Application code can interact with CopyableCell instances through the CopyableCellDelegate…


Yes, that is a nice feature to add to one’s tables. Source is on github, check it out!

h/t: @ardalahmet!

Continue Reading →

Embedding an HTTP Server

Now here’s a topic we haven’t posted anything on for multiple years now: embedding an HTTP server in your app. More specifically, making it convenient to do so, with

Java-style servlets in Obj-C using Mongoose Server

… in this post I’ll introduce a wrapper class for the Mongoose web server which tries to emulate the concept of Servlets, common to Java developers… Also note that while the sample project is aimed towards iOS devices, you should be able to use this wrapper in any Objective-C project…

If you’ve got something like a scripted game in progress, this kind of thing can save you a whole lot of cycles during development, indeed. If it looks like something worth looking into further for you, hey here’s the code on github to check out!

Continue Reading →

Glossy Buttons

So it’s been a while since our last shiny buttons post — and why yes, yes it’s time for an update; here’s a piece of code that looks like our new goto library for the shiny thing:

iPhone Glossy Buttons

The two points I was after was the “rounded” gloss on the top, and the neat highlights at the top and bottom to give the button the appearence of being inset in in the surface and rising above it.

So I looked everywhere on the net for code for such a button, without success … Anyway, I had to come out with my own code, and this meant understanding how Core Graphics does clipping – not a small thing!

rounded_button_2.png rounded_button_1.png

Now that’s some nicely done shininess, indeed. Definitely looks like we’ll be adopting that.

h/t: @rwenderlich!


Custom shapes, borders, and gradients: waterlou / UIGlossyButton!

Continue Reading →

Tip: Auto Build Numbering

Here’s a handy tip for, as the title says,

Auto-incrementing Build Numbers in Xcode

What we want to do is to have the build number available in our Info.plist file, so that it can be read and displayed at run-time. And we also want Xcode to automatically increment this number for every build.

Add a key named CWBuildNumber to your Info.plist file, and set it to a sane start value, maybe “0″… Secondly we want to rewrite the target’s source Info.plist file, not the file bundled with the application, so make sure to order the script phase before the Copy Resources phase. Then just add this tiny script phase to your target build:

Works nicely no doubt, but around here we don’t want every build to auto-increment exactly; how we like to set our projects up is that in Info.plist CFBundleShortVersionString is the version string displayed in the App Store, “1.0″ and so forth, whilst CFBundleVersion is the number of the Subversion revision it was built with. Makes matching up code with bug reports trivial, that does. And the script there is applicable to that strategy too; just instead of incrementing by 1, set it to the output of svnversion:

svnversion is a program for summarizing the revision mixture of a working copy. The resultant revision number, or revision range, is written to standard output.

It’s common to use this output in your build process when defining the version number of your program…

Not so common in the iOS world, especially since everyone and their dog seems to use git these days for no compelling reason we can figure out; but it works nicely for us to identify the code that goes with a given build instantly.

Continue Reading →


This looks pretty handy for a variety of image manipulation needs:

Introducing NYXImagesUtilities

1. Filtering

This category allows you to apply filters on a UIImage object, currently there are 3 filters : Sepia, Grayscale and changing opacity…

2. Masking

This category is composed of a single method which allow to mask an image…

3. Resizing

This category can be used to crop or to scale images…

4. Rotating

With this category you can rotate or flip an UIImage object…

Handy enough with that, but it’s been on rather a roll of updates since:

New category for NYXImagesUtilities : Saving

New category for NYXImagesUtilities : Reflection

New category for NYXImagesUtilities : Blurring

And at this rate, no doubt quite a few more by the time you check out the code from github!


NYXImagesUtilities becomes NYXImagesKit

Continue Reading →

App Design Process

Here’s an interesting read on the process of designing an app:

The Process of Visually Actualizing an iPhone App (But Losing the Race)

Since I had a bunch of design work made for an app that did not reach App Store in time, I thought: Why not share this in a blog post so that people can see and feedback on parts of the design process that I use and advocate? So, here is a selection of some of the visual deliverables that I regularly produce in a mobile app project…

That sound like it’s a bit heavy on the paper side for you? There’s a number of visual design helpers springing up these days too. A couple that’ve caught our eye recently:

Prototypes is a $40 Mac app that lets you deploy mildly interactive image mockups to the device.

AppCooker is a $20 iPad app that has a really rather remarkable current and allegedly forthcoming feature set for all sorts of app design tasks; check out the review here.

The blog that review is from also has a previous series which looks like it nicely summarizes the state of app design up to the two just mentioned:

Prototyping tools for iOS app Design: Part 1 – classification

Prototyping tools for iOS app design: Part 2 – Pen, Stencils

Prototyping tools for iOS app design: Part 3 – Bitmap based kits

Prototyping tools for iOS app design: Part 4 – Vector based kits

Prototyping tools for iOS app design: Part 5 – Applications

Prototyping tools for iOS app design: Part 6 – Libraries

So getting through all that should bring you pretty much up to speed on the state of the union in design tools, we trust.

Aaaand while we’re collecting design-related stuff, here’s some more worth reading recentish links with hints and tips:

iOS Usability Tips and Resources for iPhone and iPad Apps

A Useful Collection of iPhone/iPad Apps Developer Tools and Resources

All It Needs Is Love

Money Can’t Buy You Love: Why Some Apps Work, Some Don’t

HOW TO: Create a Blockbuster Mobile App

h/t: @joe_carney, @globalmoxie, @Dylan_Beadle, @jfmartin67

Continue Reading →

Unit Testing Intro

So apparently tutorial juggernaut Ray Wenderlich is actually a franchise these days. When did that start? Haven’t been paying enough attention, apparently. But the team seems pretty solid, if this latest one we noticed is any indication:

Unit Testing in Xcode 4 Quick Start Guide

We’ll cover how to set up Xcode to use three different unit testing frameworks:

  • OCUnit, which is the unit testing framework built into Xcode
  • GHUnit, which is a third party framework with some extra cool features
  • OCMock, which helps you write mock objects to aid tricky testing scenarios

Good stuff, good stuff.


It’s from Mike Ash, so you know it’s worth reading: Writing Unit Tests

Objective-C Library Of Matcher Objects For OCUnit, GHUnit, Cedar, More For Easier Testing

Continue Reading →

Tip: UIWebView Resizing

So let’s say you’ve got some rather long scrollable content you’re formatting on the fly in a UIWebView. And then the client decides they want the font size to be user changeable. No problem you think, tick ‘Scales to Fit’ and ‘Multiple Touch’, and …

… and now your content is drawn at ‘unreadable squiggle’ size. Whoops. But lo, courtesy of this Stack Overflow question, here’s a super easy way around that:

If you have control of the web page, it is easier to control the UIWebView with http than programmatically.

<meta name=”viewport” content=”width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;” />

<meta name=”apple-mobile-web-app-capable” content=”yes” />

Handy, that ‘viewport’ thingy!

Continue Reading →

Twitter Workshop

So how about that iOS 5? Pretty nifty [REDACTED] huh? And have you checked out [REDACTED] yet? And woah, man look at [REDACTED] will you?

But you can find links to all that good stuff plenty of places no doubt; here’s a non-redacted, why non-WWDC even, one you might have missed and if you’re around San Francisco on Wednesday you probably want to check out:

Twitter and iOS – an Integration Workshop

Hi everyone,

We’re incredibly excited about the announcement that Apple made at WWDC today. We believe that Twitter’s deep integration with iOS is going to open up a lot of exciting opportunities for developers. For your apps, this includes:

  • single sign-on and lightweight identity
  • taking advantage of the tweet sheet feature
  • the ability to tweet a photo from your app
  • pulling down a user’s following graph

and a whole lot more. As part of the announcement, we’re looking to host a workshop at Twitter’s headquarters this Wednesday (6/8) from 6:30pm to 8:30pm at 795 Folsom Street. At this event, we’ll cover what the integration hooks mean for developers. Loren Brichter will also be talking about ABUIKit, a UI framework specifically for Mac, which we’ll be open-sourcing.

… RSVP at [this] link

We hope you’ll be able to join us for the evening.


Good stuff, good stuff. As apparently the last person on the planet with a computer that has managed to avoid getting a Facebook account so far, we’re certainly quite pleased indeed that Apple chose the correct social platform to integrate with!

h/t: @alanQuatermain!


Further interesting commentary here: How Twitter + iOS 5 Will Change Mobile Apps

Continue Reading →
Page 30 of 97 «...10202829303132...»