Category Archives: Objective-C

Playground for Objective-C

With Swift, we get Playground that’s allows us to experiment learn. But for those of us still in Objective-C and don’t really care for the new language or can’t touch it until lucky enough to work on a new project, we now have Playground for Objective-C thanks to Krzysztof ZabÅ‚ocki.

You can find the repository at https://github.com/krzysztofzablocki/KZPlayground.

He also made couple of screencasts. See below.

Demo – get excited

Playgrounds for Objective-C from Pixle on Vimeo.

In-Depth

KZPlayground overview from Pixle on Vimeo.

Resources for Learning To Write Unit Tests in iOS and Cocoa

I used to joke that writing unit tests for iOS development is not necessary since there’s a compiler and laugh real hard. What I realized was that some people thought that it wasn’t a joke. Even worse, when I asked about unit tests during interviews, some candidates didn’t know how to write tests.

The root cause of this, as I see it, is that writing tests aren’t really covered at Apple’s developer documentations. And with all the new boot camps and training courses turning out iOS developers not covering testing at all, testing issue escalates to yet another level.

Here are a list of my recommendations to get started. I will create screencasts on iOS development in the future since I have more time and will ALWAYS show tests along with anything I do. Hope this helps and ping me with any questions, I’ll do my best to help.

Screencasts

Great screencasts by Jon Reid with real world examples
UIViewController TDD
iOS Model-View-Controller TDD
Objective-C TDD Example
Lynda.com has a course based on Xcode 4, but just about all the stuff still applies.

Books
Test-Driven iOS Development (Developer’s Library)
Test Driven Development: By Example

Blogs/Online
Since you’re already here, please check again for contents as I create them regularly (hopefully) 😉
Quality Coding for iOS Developers – Jon Reid
devmonologue.com – start with Introduction to Test Driven iOS Development

Cocoa’s Nil Behavior to Ruby

As you may or may not know, when you send a message to nil in Cocoa, it doesn’t do anything and certainly doesn’t raise any exception. You may or may not agree with the design, but we’ve all programmed just fine with this fact.

Having said that, what if you wanted the same behavior in Ruby?

NilClass.class_eval { define_method(:method_missing) {|*args| self} }

Is this a good idea?

* this is a code joke, please don’t take it too seriously

Cocoa/Objective-C Book Recommendations

*** Disclaimer ***
I didn’t get to completely read some of the books on this list. In fact, I went through the books to see the quality of the material and the style of the writing.
***

Cocoa and Objective-C: Up and Running – This may be considered outdated by some, but think it lays a solid foundation for beginning developers. He wrote ton of tutorials on Cocoa before it became cool with iOS and real contributor to Cocoa community.
Learning Objective-C 2.0: A Hands-on Guide to Objective-C for Mac and iOS Developers
Effective Objective-C 2.0: 52 Specific Ways to Improve Your iOS and OS X Programs (Effective Software Development Series
Advanced Mac OS X Programming: The Big Nerd Ranch Guide

Xcode Snippets Backup

I recently had the misfortune of losing my code snippets in Xcode that was built over the years. I was able to recover some, but can’t believe that I forgot to backup properly. Yeah, talk about monumental screw up.

The snippets are located at ~Library/Developer/Xcode/UserData/CodeSnippets and that should be backed up daily. That’s what I’m now doing.

In case you’re not using snippets, then I highly recommend that you do since they’ll greatly increase your productivity. I know, duh.