Getting your Mac to talk with NSSpeechSynthesizer

No Comments

When I got a Mac mini in 2008, one of the coolest things it could do was speaking. That is an accessibility feature, but not being disabled never prevented me from staying hours typing random stuff on terminal just to get to hear the computer talking.

It turns out we developers can use that feature too. And it just takes a few lines of code. Start by opening Xcode and creating a new project.


Screen Shot 2015-06-10 at 7.34.30 AM More

[Book]Cocoa Programming for Mac OS X

1 Comment

People ask me very often what they should do to get started in programming. I usually tell them to read books. And what’s the best book for those who want to learn Mac programming? It’s Cocoa Programming forMac OS X by Aaron Hillegass. This book is the best, it simple defines what we are, it’s our bible. The book considers you already know a little C or C++ and teaches you everything a decent Mac developer should know: from a hello world to printing, web services and Core Animation.

The guy who wrote this book can be considered the world’s best Cocoa teacher. He taught Objective-C at companies like Intel, NeXT, Apple and Microsoft. He is also the own of Big Nerd Ranch, a very famous training center.

Now let me tell you guys about my faith testimony. I started to try to learn Cocoa in the beginning of 2008, I had gave up and started to look for alternatives to Objective-C. I mean, that syntax looked so weird. A very long time after that, in the end of 2009, Lars Bergstrom told me about this book. In less than a month I was writing my first commercial app.

At the time I’m writing this, it costs $30.24 USD on Amazon. It’s not the world’s cheapest book, but it isn’t the most expensive one. It’s worth investing on a copy. Get it on Amazon.

Share and Enjoy:

Objective-C on other platforms

No Comments

As some of you know, NeXTSTEP was very popular because it allowed developers to create applications in a fraction of time it would take on the other platforms. What if we could program in Objective-C on Windows, Linux, BSD and other platforms? Yes, we can! Here I’ve got a couple tips for those who want to port Cocoa apps to other OSes.

Cocoatron

Cocoatron is a very young alternative. It was started in 2006. It promisses to be the “Cocoa for Windows” implementation. It’s not very mature and you will often find a NSUndefinedClass, which will make your app crash. You must be using a Mac in order to compile code using Cocoatron. Not to mention the fact you may end up having to use the WIN32 API for some stuff.

GNUStep

GNUStep seems to be the best choice if you want to program in Objective-C on other platforms. It features many tools like Gorm(similar to the Interface Builder), ProjectCenter(similar to Xcode) and a couple other apps. It can be implemented on Linux, Windows, BSD and most(if not all) operating systems out there. And best of all, it’s released under GNU Lesser General Public License(AKA LGPL) which allows you to create commercial and closed-source app using it. It uses its own drawing system, which will not allow an app to look like a native app. The workaround is to theme it! It has a great themming functionality. Also, you must ship the GNUStep installer with the apps you create using it, otherwise they will not work.

Bonus: CoreFoundation

CoreFoundation isn’t written in Objective-C, but Apple has made it open-source. One of its biggest problems is the fact it’s an old version of CoreFoundation. It’s the CF from Tiger, newer versions are not open-source. It can be ran on Linux and Windows under Cygwin.

I’m proud of myself!

1 Comment

As a programmer, I always have study(no metter what you know, you never know enough). Now I’m learning advanced C and Objective-C. I’m reading a great book called Advanced Programming for Mac OS X. This book was wrote by one of my idols: Aaron Hillegass. You know when you’re proud of your progress? I’m feeling this way! :)

I just learned how to make an application read simple plugins. It may seem that easy. OK, it doesn’t only seem easy, it’s easy. Programming for Mac OS X uses to be really easy and this is not an exception.

As I was just doing this to learn, I created a simple terminal application that loads a plugin and get a message from it. Bellow you can see the entire code used to load and read the plugin(s):

More