Ad

Our DNA is written in Swift
Jump

Author Archives rss

Mutability Preserverance

Apple consciously separates mutable and immutable variants of classes in Objective-C. If you have an NSString you cannot modify it, only by creating a new one with additions to an old one. If you want to mutilate mutate the string itself you have to use it’s subclass NSMutableString. Internally those are the same CoreFoundation type, yet the design choice was to have an immutable class and add mutability methods in a subclass.

There are two items that are not immediately obvious if you start out learning to program Objective-C, that I’d like to chronicle. One of these stumped me just a few days ago.

Read more

Visual View Debugging

In this article I want to summarize a couple of “barefoot techniques” for tuning your views. Sometimes you are painstakingly putting together a UI with multiple views and you cannot tell any more where one ends and another begins.

The debugger is not really working well on this because most of the interesting information about views is hidden behind properties and you cannot usefully inspect their current contents because properties are really methods the value of which is only set when you actually call them.

But I want to share some easy techniques that I started using so that I can get this visual puzzle untangled.

Read more

CoreText Loading Performance

Somebody people told me that some function in my NSAttributedStrings+HTML would take forever but whenever I tested it, I could not see anything wrong. Then Stuart Carnie was able to send a snippet of code that, when pasted into appDidFinishLaunching, would exhibit the same problem, duplicatable.

I was stumped at first. How could I have missed it? But at second glance Stuart did not reference any of my classes, but was only using standard SDK calls. Yet, those are almost identical to what I had wrapped into DTCoreTextFontDescriptor, my Objective-C wrapper.

Then it dawned on me: this might be a lazy loading problem. Or maybe even a bug in CoreText.framework.

Read more

Locating Controversy

Now that most everybody is buying into the (probably false) rumor that the iPhone 5 will be coming in Fall, the news media were only too happy to latch onto the fact that there is a database of locations on user’s desktops that could be used to infer his location information.

Last week a young cousin-in-law of mine came to me touting “did you know that the iPhone tracks you everywhere?” to which I already had formed an opinion and response. The iPhone does not track YOU. And on famous podcasts like the ones of the TWIT network you keep hearing the false information that it is indeed GPS locations that are recorded. Not so.

In this article I will debunk some of the myths so that you don’t have to stand idly by while people are talking nonsense and thus might be tarnishing the otherwise squeaky clean image of our beloved iOS platform.

Read more

Tweeting Away the Crown Jewels

Rarely Tweets are really worth money. But as companies become more social-savvy they find that having users “pay with a tweet” for some benefits combines the viral growth potential of a tweet with the a direct or indirect benefit. When I saw an offer on Steam to buy 2 copies of the highly anticipated game Portal 2 I added 1 + 1 and figured that probably somebody out there might be interested in getting one copy (value €50) for free.

Over the last few days I did my first TweetAway, from Tweeting and Giveaway. Let’s examine the cost versus the benefit, if it turns out that this was worthwhile then we should do it more often in the future. Let’s look at the stats from bit.ly and twittercounter to see what this gained Cocoanetics.

Read more

Rewarding Gifts

Today I felt as if all the sweating over code of the past days finally got rewarded. Multiple times over.

A new iOS update, a Lion DP2 update and an Xcode update – all with minor fixes – were showing that Apple too was focussing on this reward nexus. There was a video of gay Apple employees, that can also be considered a gift to the world. My iPad 2 arrived. I ordered an 11″ Air. Makes us wonder if there is a cosmic significance to April 15th.

Ah yes, this day, 99 years ago, the Titanic chose to hit an iceberg to escape from Celine Dion’s title song for good.

During the day we had heard a rumor that Portal 2 might be lauched today, because somebody had found a page with a countdown. That had us excited and decreased our concentration while we kept returning to the page to see if the countdown had expired yet. In the end there was another practical joke in true Portal tradition: they are promoting a “Potato Sack” bundle where the number of CPUs playing these games serve to speed up the “reboot” of the evil Portal mainframe. Long story short: My raffle continues until the official launch, you can still participate.

Read more

Experiments in Blog Advertising

For the past few months I invited ads of fellow developers onto the Cocoanetics blog. I was quite dissatisfied with the payout from Google Adsense (like $1 per week) and this prompted me to search for additional methods to offset the cost of my hobby. I previously wrote about how you can express your appreciation and that my server bills for $60 per month. This mark continues to be my break even point.

Let me share the results we got with different kinds of banner advertisements and what we learned from this experiment.

Read more

Where to find fixed-staff iOS Developers?

I was given the compliment today that when asking a question on Twitter I would usually give an answer for all other people interested in the topic. I didn’t do that consciously until now, but I want to start this tradition with this article. Also if I was not following the respondents until now, this prompted me to do so.

You know, the situation is dim, we have too many developers attending WWDC and yet not enough to go around letting themselves be hired.

In preparation for a brainstorming on this subject I asked this question: “Looking for some good suggestions where a company looking to hire fixed staff iOS devs would find people. What would you recommend they do?”

Read more

Pieceable Launches Online Demos for Your iOS Apps

Just when I was sitting down to do a quick tutorial I saw a tweet that picquet my interest. Something about “Pieceable Viewer Runs iPhone Apps From Your Browser”. While the text is utter nonsense it was still tempting and so I clicked through.

Much to my amazement I found that this company Pieceable just launched the equivalent of online demos that we iOS developers where eying with jealousy on some Android app store. Just recently we heard that since Android was essentially Java you could basically also run these apps in the browser, provided you had the appropriate frameworks available.

Read more

Cocoanetics Portal 2 Raffle

Fans of this blog and twitter followers alike will have a chance to get a free copy of Portal 2 on Steam. This highly anticipated game will be released on April 19th, round about the time when @Cocoanetics will surpass 2500 followers on Twitter.

When I went to Steam to pre-order my copy I saw an offer to buy two copies and give one away. So I thought that this might be a nice way to say “thank you!” for you being a frequent visitor to my blog and for following me on twitter.

To participate all you need to do is tweet the following text. On April 19th I will have tweetaways select a random winner from all the ones who tweeted the correct phrase.

Portal 2 Giveaway by @cocoanetics (BTW a great source for iOS dev info): http://bit.ly/g5nsKG #raffle

Good Luck!