Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Uh, I did read it. Yes, it's a bad idea. So is adding random things to NSObject for protocols that it does not conform to. That's actually worse, I'd argue, since you suddenly have -[UIColor map:]. What does that do? Pass RGBA NSNumbers to the block and return a new color? Throw an exception? Silently disregard the message and return nil? At least this approach has type checking.

Just declare a normal function, which can correctly throw a compiler warning if you try to pass anything that does not conform to NSFastEnumeration to it.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: