Any thing can be a dictionary key? Yes, but with a price

January 14, 2014

I like to talk about the difference between different NSDictionary keys. I know it’s cliché.[1]

We all know that building a dictionary is slower than querying it, and that the time it takes to insert or update values depends on the hash function of the key – the interesting part is how incredibly inefficient the hashes of built in objective-c components can be.

Read the rest of this entry »

Advertisement

Custom easing animations with auto layouts

December 22, 2013

Our rock star designer Jonathan Saragousi has a fetish for beautiful easing transitions in our animations. The correct easing method can make the difference between a plain animation and a jaw-dropping one.
In Cal for instance, most of the animations use EaseOutQuart transitions. (You can find a nice demonstration of the different transitions here)
We implement the custom animations using a very cool project called NSBKeyframeAnimation.

A while ago we moved Cal to using Auto layouts, and of course – auto layout does not behave well at all with custom animations.
Read the rest of this entry »


In-app localization

December 9, 2012

Hi guys!

It’s been a LONG time since my last post – I was busy lately getting married to the lovely Einat 🙂

This time I wanted to tell you about how we added in-app localization to Any.DO

Since we added localization to Any.DO a few months ago, we got a lot of feedback asking us to add the option to change the language from inside the app.
As you all know, the common localization method is to simply use NSLocalizedString(key, comment) – a macro for [[NSBundle mainBundle] localizedStringForKey:(key) value:@”” table:nil].

Read the rest of this entry »


Selective layer borders

March 4, 2012

I always though that the most annoying problems are the ones that should have been trivial. Those pesky problems that happen all the time, and for some reason apple didn’t take the time to fix them.

One such problem is the fact that there is no easy way to draw “selective” borders – i.e draw borders only on the left and top side of the view.

This problem keeps popping up for me, the last time was when I was trying to draw a grid view with custom cells. I wanted the cells to have a 1px border, but since all cell had both top and bottom borders, the borders seemed to be 2px wide.

This time I decided to solve this problem the right way and make a simple drop-in class that provides flexible border abilities – something that I could use like this:


myView.borderDirection = AUIFlexibleBordersDirectionRight | AUIFlexibleBordersDirectionTop;

Read the rest of this entry »


Automating UI testing on the iOS

February 26, 2012

A couple of weeks ago I gave a talk about automating UI testing on the iOS at the Second Tel Aviv iOS Developers Meetup. In the lecture I introduced importance of performing automated UI testing, and discussed in details the two most significant tools in this area – Apple’s UIAutomation framework, and Gorilla Logic’s FoneMonkey framework – maybe the greatest testing tool in the universe.

Gorilla Logic - FoneMonkey

Unfortunately, The lecture was not video taped, but the presentation is very elaborate. You can find the presentation on SlideShare, and a project with all the code examples I showed in the presentation can be found on github.

In my opinion, an organized testing culture is one of the key parameters to a successful iOS project, and if you ever wondered what is the best way to automate testing on the iOS – this presentation is a good starting point.

Enjoy.


DreamZ – A lucid dreams inducing iPhone app

November 30, 2011

I recently release a new app that I was working on the last couple of months. This is my first paid app, and in my unbiased opinion, it’s one of the most interesting apps on the market today 🙂

DreamZ is a revolutionary new app that allows you to realize that you are     dreaming and control your dream, otherwise known as a Lucid Dream.

How does it work?

As you sleep you go through different phases, ranging from deep sleep to light sleep. The most interesting phase is the REM (Rapid Eye Movement) phase, in which most dreams occur.

Based on your body movements while you’re asleep, DreamZ is able to know the exact sleep phase you are in, using the built-in iPhone’s sensors.
Read the rest of this entry »


Adding custom code snippets extensions

November 1, 2011

One of the most useful feature of xcode 4 was the built in code snippets library. It allows you to use pre made pieces of code instead of writing them over and over.

You can use those code snippets either by dragging them from the Code Snippet Library section, or by simply typing a completion shortcut.

xcode comes with a variaty of useful code snippets which you are more than welcomed to browse, but today I will show you how to add your own custom code snippets.

Read the rest of this entry »


The importance of custom primitive properties in CoreData

October 23, 2011

The topic of this week’s post is responsible for hours of frustrating debugging that I went through the first time I developed a large project using CoreData.

CoreData is really great once you learn how to use it properly, but it’s learning curve is pretty steep. And as if to complicate things a little further, the templates xcode is providing are pretty useless at best, and down right buggy in several cases.

Lets see an example where xcode’s template can cause severe bugs:

Read the rest of this entry »


Instantiating custom views from nib

October 18, 2011

Hi again everyone!

Subclassing UIView to create your own custom class is one of the most frequent tasks an iOS developer has to do.

And for me at least, every time that i created my own custom view, i was torn apart by what is the correct and more convenient way to design my view – from code or from interface builder. I always thought that there was no “right answer”, and that this decision depends on the scenario.
I was wrong. Using interface builder is better. Let’s see why.
Read the rest of this entry »


Animatable text color of UILabel

October 4, 2011

Every time I talk with an android developer about the strong and weak points of iOS development, I always have the CoreAnimation ace up my sleeve. Core animation is great. Not only that it’s so powerful and efficient, it’s also one of the most elegant frameworks I got the chance to work with. In 95% of the cases you can just write

 [UIView animateWithBlock:..] 

and pass a block with the final values of each property we want to animate.

Being the lazy developer that I am, the UIView animation block is a dream come true. This is why I get so annoyed when I encounter a non animatable property, like the text color property of UILabel. That’s right – UILabel, our main component for showing text on the screen, can’t animate all of its text related properties, like textColor, text, font, etc.

If we want to animate textColor, we have two simple but ugly options, and one complicated but delicious solution. Lets talk about the uglies first.
Read the rest of this entry »