Ad

Our DNA is written in Swift
Jump

genstrings2

Actually I am on vacation, but I couldn’t help myself using the breather to work on a little hobby project. This I shall reveal to you today!

If you localize your apps (iOS or Mac regardless) you are probably used to working with genstrings. Probably painfully working, which is why we built the Mac app Linguan which remote-controls genstrings and merges the results with your previously existing tokens.

But genstrings has several big problems.

Read more

Myth Busted: iPhones Won’t Work With Gloves

Imagine me getting a mani-pedi during the Christmas holidays. No, really! We have a lady come to our house regularly and doing all willing feet.

Somehow our casual conversion came to the iPhone. Now imagine this healthcare professional telling me:

“For me the iPhone is no option because it does not work with the gloves we use”.

One does not have to say THAT to me twice. This myth was begging to be busted.

Read more

How to Make and Apply Patches

Sometimes you want to tell somebody how you fixed a problem in their code, but for some reason the code is not on github so you cannot send them a pull request. If you felt really smart then you might put the changes you made into an e-mail, like “in file1.m:102 you change it to x, in file2.m:54 you make change y”. Thought this doesn’t really help the developer you are trying to help. Even when following your change instructions to the letter it is a tedious and error-prone method of applying your changes. Thanks to M. Douglas McIlroy, Adjunct Professor at Dartmouth Colleague – one of the early Unix pioneers – there is a better way. He invented the form of diff that we are using today to get the Difference between two versions of a file. And Larry Wall who invented the patch command which can take a diff file and effectively apply it to files. Read more

iOS 5 Breaking NSDateFormatter?

Robert Meraner asks:

“Do you have any idea why this code works in iOS 4.3, but no longer under iOS 5? Googling it seems to turn up some ideas, but no immediate explanation.”

This is the code Robert refers to:

NSString *currentElementValue = @"01.12.2011 09:35:13 CET";
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd.MM.yyyy HH:mm:ss zzz"];
NSDate *date = [dateFormatter dateFromString:currentElementValue];

This got me confounded initially as well, but thanks to Cédric Luthi we got an official answer to this riddle: works as intended!

Read more

Apple’s Patent on NSDataDetector

Apple owns patent US5946647 and slapped that around HTC’s team of lawyers successfully. Apple has previously sued HTC over them infringing 4 of their patents seeking to block sales of several Android-based mobile phones that HTC is making. On December 19th the International Trade Commission published their final determination as to the validity of two claims in this patent while finding no infringement on the others.

This result is interesting for us iOS developers for several reasons. For one it shows that something we are taking for granted was actually patented by Apple. They filed it on February 1st, 1996 and the patent was granted 3 years later on August 31, 1999. Usually patents are very elusive and it is generally hard to show how a device or operating system really infringes upon them. But in this rare specimen Apple has the rights on something that you probably see every day.

Read more

Bit Masks

Joseph Collins asks:

How do you decipher a bit mask from an argument which logically OR’d multiple values together? Enum uses bit shifting.

This question came to me while looking at UIView’s header file and wondering how Apple handles the animation options bitmask.

If you have several modes of something then usually you get by with an emum. But if you can combine several flags in s single value then you have to do this by means of bit masks. Let’s explore these today.

Read more

BinPress Contest Results

Today BinPress announced the winners of the component contest. I had the pleasure of being one of the judges.

BinPress had custom-built an internal microsite for us judges where we could download the source code and fill in a form with our judgements. That allowed me to go into the components I was assigned to and really dig into the implementation details. Sorry, but I need to be wagging my finger here, all of the ones I saw had terrible form, little to no code style, the project setup generally was a mess and documentation non-existent.

But nevertheless a ranking was possible – especially because there where other equally important judging factors besides code quality. And so the shining winners are …

Read more

Command Line Tools Tutorial (1)

Honestly I was very much excited when I found that I can use my current knowledge of Objective-C and Foundation classes like NSString to also build nifty little tools. Previously I had to resort to bash script to perform one-off operations on files that where too tedious to do manually. But knowing what I am going to show you in this article will enable you to also write these littler helpers.

I believe that beginners should rather start with writing a couple of command line tools before diving into building user interface driven apps. Commend line tools are linear and thus their function is easier to grasp. They are more akin to “functional programming” then “object oriented programming” if you will.

I am going to show you what goes into building a simple command line tool and you be the judge whether you agree with my assessment.

Read more

Linguan 1.0.2

The second hot fix pack for Linguan 1.0 fixes a couple more issues that some of our (mostly) happy customers reported.

Changes

  • Fixed: Translations will no longer get trimmed
  • Fixed: Problem opening projects with absolute file paths
  • Fixed: Table did not update on deletion of token
  • Changed: Extended duration of “no new tokens found” HUD
  • Changed: Enter key now opens selected recent project in welcome screen

If you haven’t done so please post your feedback on iTunes. To be able to add additional features to Linguan we need to have sufficient sales. And for that we need your positive reviews, high rating and that you tell other developers about Linguan.

Today is the best day for them to also get a copy because: As a Thank You for your interest in our app we reduced the sale price by 50% until the new version gets approval by Apple.

Coding Style

Dany asked:

I’m looking at your (nice) project NSAttributedString-Additions-for-HTML and I have some questions about your convention of writing code.
I really hope that you can reply to me, and maybe can be an idea for a future blog post (on naming conventions, and conventions in general for objective-c).

I adopted several styles I read about in the coding style guides by Google and Marcus Zarra, though I have to admit I only skimmed through these and picket a couple of things that made sense.

Though it is good practice to reflect on your style every once in a while to see if it still serves the purpose of making your code easier to maintain and read.

Read more