In this weeks episode: We write our first program, a coin flipping simulator, and learn how to break off CPU-intensive tasks into separate threads. Download project files.
Hot Cocoa Episode 3 – Portable / iPod: Download
Hot Cocoa Episode 3 – HD: Download
Questions or comments? Post them here, or e-mail them to: kevin [AT] lastedit.com Thanks!
Follow me on twitter: http://twitter.com/darkfox8963

November 2nd, 2008 at 5:32 pm
wow! that is just what i needed to start transitioning from web scripting to the desktop. thank you very much for putting this together. I am definitely looking forward to the next one!
November 6th, 2008 at 4:12 am
Actually got it to work. Only had one issue. When I declared the Object we added as AppController nothing populated in the other fields and I had to add them manually before I could finish building the interface. Was that because all the code wasn’t in place yet or something else I may have done wrong? I’m a complete beginner here but the code ran without a hitch. Thanks and keep up the good work.
One comment also, you might want to slow down when you are clicking around and tell people what you are clicking on to make things happen sometimes. I had to stop, rewind and play sections a few times to catch what you did since you go pretty quick. I used to teach UNIX and was accused of that by my students sometimes since I would keep pushing to keep on schedule.
November 6th, 2008 at 4:20 am
The header file for the AppController class (AppController.h) needs to be complete before the outputs and actions will show up. Usually if they don’t show up for me it’s because I typed them in the header file, but then didn’t save it before I switched back to Interface Builder.
As for the length I do tend to go a bit fast past the parts I have covered in previous episodes since I’m trying to keep the length under about 25 minutes (More a production time thing than anything else, a 30 minute show has been taking me 7-8 hours to encode and get online). Btw, what did you think of how the code was cut in? I cut it cause I figured people would get bored of watching me type and they could pause if they wanted to read, but I can slow it down if needed.
November 6th, 2008 at 12:15 pm
I can relate trying to keep within your time frame. For someone like me who is completely new to Macs, Obj-C, Cocoa, and the X-Code interface some things you did weren’t apparent. When you went to the Interface Builder to make the connections I never did actually figure out how you got the interface to pop back up. I finally figured it out by double clicking on MainMenu.xib but it looks like you did it differently. Is there a keyboard shortcut?
I like how you did the cut ins for the code. You’re correct in assuming people don’t want to watch you type in all of it. Had no problem pausing the show and typing it in myself.
Overall I think you are doing a really good job here. I wouldn’t stress too much over the timing. Just be aware that the students can’t actually see what you are doing and throw them a bone every now and then like mentioning that you have to save the header file before outputs will populate automatically. When we got to the scripting part of my class I would usually throw out a hint or two of common errors students usually made to help them with troubleshooting their scripts.
Looking forward to the next installment of this. The last time I did any real coding was college. They taught Cobol and Fortran back then! I’m trying to read through an Objective-C book along with this and then have a Cocoa book and an OpenGL book lined up on the book case next.
November 6th, 2008 at 3:03 pm
Ah yeah, that was a bit of editing slight of hand there cause the segments were originally in a different order, and there was a section of the show about NSLog that I decided to cut and make into a mini segment. Really all I did though was to click back to Interface Builder in the dock since it’s a separate application from XCode. Double clicking on the .xib file will work too though. Sometimes though when using the dock to switch between them the interface gets hidden behind XCode’s window, so that’s why I usually do Hide others (Opt+Cmd+H) after I switch between them.
If you’re looking for a good Cocoa book I recommend Cocoa Programming for Mac OS X by Aaron Hillegass. It was actually that book that got me started doing Cocoa programming and that part of the podcast is based on.
November 6th, 2008 at 6:13 pm
That’s the Cocoa book that I have. Haven’t even opened it yet. I was reading the programming links you have listed and the one about Cocoa made a statement that if you don’t know C, Cocoa isn’t a good place to start. I’m working through a beginning C book also to get up to speed. Trying not to get lost here!!
November 8th, 2008 at 3:11 pm
Excellent first tutorial, this is the very best so far I have found on the web, keep up the good work! Thanks for the swift email reply too. James
April 1st, 2009 at 12:45 pm
Hello, Kevin.
IN the function: [NSThread detachNewThreadSelector:@selector(
And if the selector uses more than 1 parameter ? how to pass it ?
April 21st, 2009 at 5:26 am
Hello Kevin,
I am new to the Mac system, I am interested in teaching myself how to create basic programs and try and have a little fun doing so. I have in the past created a database software program to manage my clients, however i did not write or create the code.
It has been an ambition of mine to have a go.
I struggled to get your first episode and was only able to get/start by watching your episode 3. WOW!
Kevin, I am in total awe of you, your presentation and style of demonstration is just great. I am so keen to learn more.
Could you help me with episode 1, 2, I would be forever grateful. Episode 3 was pretty heavy for a first timer like me, however I will not give up and want to really give this a go.
Words can only fail to describe how happy i am to have found hot cocoa
Hot Cocoa Rocks!!
cheers
Paul
April 23rd, 2009 at 2:50 am
I found your video tutorials on itunes video podcasts. I cant thank you enough for the time and effort you put behind each episode. Your doing a great job!
May 4th, 2009 at 2:29 pm
Thank’s !!! Awesome tutorials…!!!
On this one, instead of “awakeFromNib” i would use init… something like:
-(id)init{
isFlipping = NO;
self = [super init];
return self;
}
what you think?
thanks again!
iBob.
August 9th, 2009 at 5:11 pm
Wow. I love your style and effort you put into each screencast. Smooth and seemingly effortless. Keep it up! You work is appreciated!
Also, though I’m not a programmer (yet) I was thinking something similar to what iBob(#11) mentioned as that what I’ve seen in other tutorials.
August 15th, 2009 at 8:46 am
Hey!
I’ve been attempting to dive into Cocoa development for well over a year now, and this is by far the best (at least on the Internet–I haven’t bought a book) guide to starting that off I have come across.
I, for one, like the pace you are taking. Sure, there were a few areas where I was lost as to what you did, but each time it took less than a minute to catch the problem and I learned something new. I’m glad you expect certain bits of terminology and programming knowledge to be understood.
Thanks!
February 14th, 2010 at 11:06 pm
Wanted to let you know that I just found this site…and thanks, I’m really impressed and glad it’s here! I’m brand new to programming, and really want to focus on Objective C and Cocoa – bought Objective C for Dummies and despise it. Your tutorials, however, seem to really be what I’m looking for. So…until Objective C for Absolute Beginner’s is released, I think this is going to be a main source. Thx!