Get Updates By E-mail 

Article Written By:
Johann Dowa

Getting Subclasses in Objective-C

One of the things that makes the Objective-C language “different” from most other object oriented programming languages is that there is no simple command that allows you to print the subclasses of a class.  I noticed this early on when using the language, and had to work around this.  I don’t know why Objective-C doesn’t have a simple command for doing this (to be honest I never thought about it until this moment), but recently I saw an article on exactly this, and found a few ways to print out those subclasses.

The article I saw was on Cocoa With Love, and entitled Getting Subclasses of Objective-C Class that explains Matt Gallagher’s approach to getting the subclasses.  Overall this isn’t the most complex task in the world, but as he explains there are considerations to be made as to why you would choose his first approach over the obvious “hackers” approach which he also explains.

It’s a great read if you ever need subclasses, but as said in this Stackoverflow discussion on getting subclasses you may want to change things up if you are in need of this functionality.

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.