Screencast iOS Categories iOS

  • Jon Friskics
Badge student

Locked Content

A subscription is required for viewing this video. Enroll now to get full access to all Code School courses and content.

Enroll Now Sign in


  1. Wei Fan Chen said

    really useful :)

  2. Jon Karna said


  3. Cenny Davidsson said

    very nice!

  4. thehappycoder said

    Is objective-c compiler able to detect method name collision and issue a warning?

  5. Faculty

    Jon Friskics said

    re: detecting method name collision if you implement the same method on the same class in two different category files - unfortunately there won't be any warnings generated. Here's an example:

  6. thangnq said

    thanks :)

  7. Nils Diestler said

    Thanks, this informations will be very useful

  8. Rizwan Javaid said

    Thanks for your clear explanation :)

  9. Sergio Barrera said

    Great video!

  10. Angel Camilo Aguilar Fernández said

    Excellent video! Thanks.

  11. pjones said

    More Please!

  12. Cezar said


  13. nmr5316 said

    make you make something on Protocols

  14. Daniel Blair said

    Cool, very interesting.

  15. Daniel Blair said

    Cool, very interesting.

  16. Gregory Zentkovich said

    Thanks Jon for a great video! You did a great job of explaining iOS Categories and making it easy to understand...

  17. Artem Stepanov said

    Awesome video!

  18. Joe Kueser said

    May be a stupid question, but is there a reason these should be class methods rather than instance methods? It seems that "if ([self.emailField hasValidEmail])" would be more readable than "if([UITextField fieldContainsValidEmailAddress:self.emailField])" Is that possible with categories, or would something like that require a subclass?

  19. Faculty

    Jon Friskics said

    Joe - not a stupid question at all! You can define either class or instance methods. In this example I wanted examples of each, and since I started by talking about instance methods on NSArray, I used class methods in the UITextField examples.

  20. Stephen said

    Would categories be used more or less for 'cleaning up' your code? I feel that helper methods can be easily defined in the file of the view controller/class/etc. you're working in.

  21. foffer said

    Really good video Jon. I've been wondering for the longest time what those + signs where doing in some of the files kicking about, you explained it perfectly! Thanks - Chris

  22. danielng01 said

    So if there is name collision which method is executed?

  23. danielng01 said

    To answer my own question the result is unpredictable, but you can set OBJC_PRINT_REPLACED_METHODS to YES to get warnings from Xcode

About This Screencast

Categories are a powerful Objective-C language feature that allow you to add methods to classes without subclassing - even methods that are part of frameworks like UIKit and Foundation. In this screencast, you'll learn how to create and implement methods by adding categories to a project.

You need to be an enrolled student in order to view this video and subscribe.

Enroll Now