All Posts For: Cocoa

Mar 28 2014

Designing Interfaces for iOS 6 and iOS 7

Although the iOS 7 adoption rate is now at 85 percent, many developers still need to support iOS 6. I’ve seen people struggle with designing their interfaces so that they look at home on both versions of the operating system. This blog post will show you the best practices for achieving this goal.

Dec 19 2013

Tell the Story

I love stories. I love telling stories, and I love listening to stories. I learn from stories. I believe that we, as a programming community, don’t tell enough personal stories around the campfire.

Some may think it heresy, some may think “well duh”, but I believe that the programming profession is still really primitive.…

Nov 27 2013

Stochastic Profiling

I’ve talked about stochastic profiling in the past, such as the fairly recent Rock Heads. It’s something I mention when I talk about debugging or performance tuning at various conferences. Interestingly enough, I had a need for it last night because I had stumbled into an often-reported, difficult-to-reproduce problem and wasn’t in a situation to hook up Instruments.…

Nov 8 2013

Xcode Breakpoint Wizardry

Every great developer should know how to use a debugger. Xcode has an excellent debugger UI that wraps LLDB (or, if you’re living in the past, GDB), giving you access to all the standard tricks like breakpoints, stepping in and out and around your code, and stack frame details.…

Nov 7 2013

Smooth (Bitwise) Operator

One of the wonderful(?) things about Objective-C is that it’s based on C. Part of the power of C is bit-bashing, where you can manipulate individual bits inside of a piece of memory. Have a bunch of boolean values but don’t feel like wasting a byte or two for each one?…

Oct 15 2013

Should I Use a Property or an Instance Variable?

One of our interns recently asked what seemed like a fairly innocuous question: “What are the scenarios where the use of instance variables would be more preferred than using properties?” At Big Nerd Ranch, we strongly prefer using properties to direct ivar access, but take a sampling of the Objective-C community and you’ll find almost as many answers as there are developers:

“I always use properties and always access via properties (except when ivar access is strictly required).”
“I strongly prefer properties unless there is a very good reason to use ivars.”
“I generally prefer properties but will occasionally use ivars for simple state variables where the overhead of a property is unnecessary.”
“I use properties for ‘public’ things and ivars for ‘private’ things.”
“I often change ‘self.value’ calls to ‘_value’ because it’s much faster.”

Using properties has some very tangible benefits, particularly when it comes to debugging: they provide a single place to set a breakpoint on access or change, they can be overridden to add logging or other functionality, etc.…

Older posts