iOS & ObjectiveC Iphone Developer Technological

Creating Reactive Cocoa Xcode project

Installing Cocoapods on Mac by Marcio Valenzuela
Installing Cocoapods on Mac by Marcio Valenzuela


Earlier I posted an

article on using RAC.  It

was a plain vanilla

example of using RAC.

While I AM working on

a second post with

more useful examples, I

wanted to go over how

to ADD RAC to a



First, you must have ruby installed.  

This means, go to Terminal and type in:

which ruby

This is what I get:


Important to note here that if you don’t have that rvm bit, you might still have ruby.  RVM stands for Ruby Version Manager and for what little I know about ruby, its one of the managers available for ruby but there are others.

If you don’t have ruby, you will need to install it.  Use this article ( but just use the section “Install RUBY using RVM”.  DO NOT follow the Xcode Command Line Tools section as that doesn’t work anymore.

For the Xcode Command Line Tools just check this out (

Second, you need Cocoapods installed.  

This is as simple as typing, again in Terminal:

which pod

If you get some folder, you’re ok.  I get:


Otherwise you will get just the prompt or:

pod not found

So you need to install it.  This is a bit easier.  You can always refer to this article ( but basically:

Makes sure your gems are up to date by typing in Terminal:

sudo gem update –system

Again, remember Command Line Tools don’t show up in Xcode>Preferences anymore and they don’t install that way either so SKIP that part of this article.

Now type in:

sudo gem install cocoapods

You will see a bunch of stuff and then:

Successfully installed Cocoapods 0.29.0

or something like that.

Now type in:

pod setup

And you will get a master repo created.

Now remember the idea behind this is to be able to download Pods or projects and link them to your project.  You know, instead of having to import a downloaded 3rd party project folder and having to link search paths and this and that and the other.

Third, let’s use Cocoapods to install the ReactiveCocoa pod into a project.  

For this we will basically follow these general steps and I will do so in a video to make this easier

  1. Create SingleView project in Xcode
  2. Create Podfile & Use it to install RAC
  3. Open the Workspace & configure it

Iphone Developer Technological

How to Read iOS or Mac OS Programming Documentation

The toughest part for me to get started was reading the Apple Documentation on iOS or MacOS. When I got into more APIs it got more complex. You need to understand how to read API or proprietary code documents in order to understand how to create a piece of code, connect to web services or debug changes in code.

You will very often see the term DEPRECATED, which means a particular method name is no longer used. This is very important so let’s take a look at Apple Docs first:

NSArray Class Reference
Santiapps. Marcio Valenzuela. Learn to program for iOS or MacOS

This tells us that the object of type NSArray has many methods that you can call on it. They may be Instance or Class methods but they are all listed here. If you want to know what an object can do, you ask it for its type and come to the Class Reference site.

Notice there are many tasks you can call on an NSArray:

5. NSArray Class Reference
Santiapps. Marcio Valenzuela. Learn to program for iOS or MacOS. Understand how to read NSArray Class Reference.

Notice the task with red text next to it that reads “Deprecated in…”. Like I said it says it was deprecated after a certain version of the OS. Now let’s suppose we want to know about a particular method we can use on this type of object, let’s look at initWithObjects, it only sounds natural that if we want to create an array, we would like to put objects in it:

6. NSArray Example
Santiapps. Marcio Valenzuela. Learn to program for iOS or MacOS. Understand how to read NSArray Class Reference.

This means that if you call our standard way of creating any object:

Object Class *objectPointer = Object Class alloc …

and then we insert that method signature -(id)initWithObjects:(id)firstObject…

we get this:

Object Class *objectPointer = Object Class alloc -(id)initWithObjects:(id)firstObject

we can start putting objects into our array object. Now let’s look at the correctly formatted code:

NSArray *myArray = [[NSArray alloc] initWithObjects:@”hi”, @”bye”, nil];

Notice we took out the -(id) at the beginning of the method signature because this forcibly has to return an NSArray object. And the reason we can add this method signature to the NSArray *myArray creation line is because we know that NSArray contains that method signature inside its Class file. We can make sure of this by using the Jump To Definition in Xcode!

Let’s do so for an example I just ran across. I had been working on a game using Cocos2d. This means I was using an API or library or third party code framework. These terms are usually interchangeable but they basically mean the same. When somebody or some company works on a bunch of code that helps you perform certain tasks. For example, Cocos2d creators worked on many Classes to create Cocos2d. One such class is CCAnimation which takes in frames and strings them together to create an animation. They recently released v.2.0 and this particular class changed some of its method signatures to include improvements I guess.

If I open my code in Xcode and try to run my old code, it crashes saying “Unrecognized Selector sent to instance”.

1. XCode Console debugging
Santiapps. Marcio Valenzuela. Learn to program for iOS or MacOS. Understand how to read NSArray Class Reference.

This means that instance of CCAnimation doesn’t recognize that old method or selector. Presumbale because they changed the old name to accommodate new structural changes. So I right click over the CCAnimation call in my code where the app crashed:

CCAnimation Definition
Santiapps. Marcio Valenzuela. Learn to program for iOS or MacOS. Understand how to read NSArray Class Reference.

And when I Jump To Definition I will be taken to that Class Reference for that Class:

3. CCAnimation Definition
Santiapps. Marcio Valenzuela. Learn to program for iOS or MacOS. Understand how to read NSArray Class Reference.

This gives me the Class Reference for CCAnimation, the one being used in my project, and tells me which methods the Class now implements. Now I just find the method which more closely matches my needs.

It’s important to learn how to go from a crash to the documentation which can help you fix that crash.


My Cover Letter for a Job Application at Apple: You will be missed Steve

I believe the best Cover Letter I can write is based on my love for Apple.  I can’t tell you I have ever sat in line for days waiting for a product launch because I don’t have the luxury of living in the US and our “quasi-Apple” stores in Honduras suck to say the least.  However, I can say 3 things with great pride:


First, that I have been an Apple fan since the Apple IIe, simply because that’s around the time I was born and have recollection.  We used to spend summers in San Francisco at my uncle’s house.  He worked for United Airlines and had a simple house but not without his Apple computer.  My fondest memories of summers in San Fran were programming those cheesy loops used to make hearts and faces on the screen by printing out characters in a certain order; and the other, playing Where in the World is Carmen San Diego!  God I loved that game.


Second, that i have been shunned for being an Apple user and I enjoyed it.  Although I used my first Apple at my uncle’s house in the 80’s, I didn’t buy my own first Apple MacBook Pro until 2000, just before entering my MBA program.  As a business school, it was all about pragmatism, and compatibility issues and out dated versions of software were all but damning because everyone made fun of me.  A professor joked about me having paid a Coke’s worth for “that ugly thing” as he put it and still gotten change in return.  He joked about how its resale value was zero and how Apple would die just like betamax, since it was one of the case studies we worked on.  I remember how in reviewing that case study we were told how when 2 competing technologies tried to dominate the market, the winner was the one that was able to surround itself with accessories which made it indispensable.  And 10 years later Steve Jobs went ahead and did just that!  Id like to meet that professor again and show him my shiny new 2011 MBA, a market breakthrough product, not a follower.


And third, that I love Apple products, am a fan-boy, love converting people, believe our products are a work of Art and would buy my milk from Apple if you had a Milk Division.  I can appreciate the customer attention to detail Apple has.  Its not really customer service because a service almost implies something that is paid for and in return, because of the commitment acquired by the employee, he provides that service.  I live in a country where even franchise-trained personnel doesn’t provide good customer service.  This is my life 360 days of the year.  Then all of a sudden I go to Miami and rush to an Apple Store, not always for a product, just for the experience.  I love walking into a place and have someone walk up to me and genuinely ask me if there is anything they can help me with.  Even if I didn’t have anything in mind before I walked in, I think of something, anything, just for the “feeling of satisfaction” I get when they solve a problem for me or recommend something that ends up making my life easier or what not.  That truly is priceless.


I love converting people because when I pick up my old iPhone 4 and show it to someone, I take off the banged up protective case in order to show the brand-new product still intact.  I remember I used to buy Ford trucks and people would ask me why I preferred them over Chevy.  My answer always came back: “Because of the quality of sound the door makes when you close it”.  It just tells you its a quality truck.  The same thing happens when you hold an iPhone or iPad or Mac or accessory…it just feels good.  I can feel the quality and appreciate the workmanship that went into creating that “device”.  Yet its not just a device, and I can tell because when I sell an old model to get a new one, the buyer gets his iPhone with the original plastic cover sticker still on the front and back, or white sheet of paper that comes with a macbook pro.  I do it because I want that new Apple user to become a fan boy by having the same experience I did when I got it new!


You know what, even if I never get a job at Apple, I would just like Steve Jobs to get this cover letter.  It would be enough satisfaction for me to know that he received this letter as a compliment and a big Thank You for how you have affected the life of this one customer and how grandly I think of Apple and its people.

Translate »