Archive for 'Programming'

AppCode IDE

So we noticed this tweet:

Experimenting with AppCode – powerful alternative to XCode4

“Alternative to” Xcode 4? That sounds like rather a solution in search of a problem, doesn’t it? Well, let’s see:

Why try AppCode?

Because of a truly smart code editor, with

  1. Thought-out and convenient code navigation
  2. On the fly code analysis with quick-fix suggestions
  3. Project-wide usages search for classes, methods, variables, resources
  4. Instant code transformation intention actions, including i18n support
  5. Better code refactorings: ‘Change Signature’, ‘Extract Method’, etc.

Hmmm. Well, those are good things no doubt, but seriously, enough to always put yourself behind the curve with your tools? Googled around a bit, and found an announcement interview:

InfoQ: What drove the decision to develop appCode?

Maxim: We at JetBrains admire what Apple has done to desktop apps and more generally to a consumer targeted software. They’re setting new interaction design quality standards. But this is not the case when it comes to developers software, in our opinion. So we see a great opportunity for JetBrains to bring its development tools expertise to this emerging market of developers, who know how a great software should look, who care about their productivity and code quality.

Well, if you say so. We’re kinda unconvinced still, but hey, maybe these guys will turn out to be the CodeWarrior of the new millennium. Doesn’t seem overly likely … but hey, if you’re interested enough to try it out, let us know what you think!

Continue Reading →

Sample Code: FuelView

Looks like a bunch of interesting snippets in this newly open sourced project:

An RSS-feed and location-based iOS application

…While the application in this post is only directly useful to people living in Western Australia, I think this is a really interesting project as it contains a lot of very useful snippets of code (some of which I’ve written posts on before) including:

An iOS version of my Gloss Gradient drawing code…

Two persistent stores with one NSPersistentStoreCoordinator…

A full set of “single line Core Data fetch” methods…

Getting the GPS location…

Pulling data from an RSS feed…

Caching data in the Application Support directory…

Function to create a two point CGGradientRef from two UIColors…

An example of using a category as an Adapter interface…

Scrolling a text field that isn’t in a table…

A Core Data Postcode database…

A flexible, reusable controller/table/cell structure…

A CheckmarkCell that self-manages radio button style selection…

Forward geocoding using Google’s Maps API…

Plus a whole lot more. It really is a densely packed little program.

Yep, if you’re planning any kind of location-based information providing, definitely you should take a look through this!

Continue Reading →


So remember a while back we mentioned an NSAttributedString displayer that had some plans to become a commercial rich text editing component? Well now there’s one out free on github — EGOTextView:

EGOTextView is a complete drop in replacement for UITextView created by enormego, that adds support for Rich Text Editing.

EGOTextView is tested to work with with iPhone OS 4.0 and newer.

We’d quote more from the readme … but that’s all there is!

h/t: @enormego!

Continue Reading →

Image Manipulation

Ah, remember the old days when it was actually a challenge to write image manipulation code? My, it certainly is about two orders of magnitude simpler these days:

iOS Image Manipulation with UIGestureRecognizer: scale, move, rotate

I promised to share with you my code that I used on the Twibbon iPhone app, to manipulate images using touch gestures. This solution uses UIGestureRecognizers and therefore only work in iOS 3.2 and above…

That’s pretty much not a problem these days, one imagines. Bonus, a selection indication implementation using CAShapeLayer:

You’ll notice in some of the code above making reference to a _marque, This is the marching ants you see when you have selected the photo and allows you to easily see the boundary line of the image…

Handy stuff, yep; source is on github!

Continue Reading →


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 →
Page 30 of 97 «...10202829303132...»