Method swizzling and refinements are basically the same thing. The real difference isn't in the features, it's in the fact that Ruby is a dynamic language, and Obj-C is only dynamically typed. You can swizzle all you want in a statically compiled program, and refinements work equally well in a "static" Ruby program. The problems with refinements start coming to light when you start refining things at runtime, i.e., with module_eval. Obj-C doesn't have this problem, since swizzling happens only once at compile time.
I don't believe that is true, you can use class_replaceMethod to dynamically swizzle methods at runtime. This gets rid of compiler error and warning messages that appear when just using categories to override existing methods. From my understanding, the compiler enforces compilation unit visibility for methods implemented in a category, but the methods actually are actually added to the global scope.
There is no "top level" object or class_eval in Objective-C, so the situation is quite different from Ruby.
Here is an interesting paper about classboxes[1] (same concept as refinements), and the source code for the Objective-C runtime[2]. I found them to be useful in my research.
Objective-C is a dynamic language in every sense of the term.
As examples, at runtime, you can:
- change an existing class' superclass
- swizzle methods
- create a class ex nihilo (though it'd be a better idea to inherit from NSObject)
- give that class (or even an existing one) methods, ivars, and properties
.. and much more
Visit the runtime reference[1] and jump into a running Objective-C app with GDB or F-Script. It's a lot of fun.