Latest 1.0.0
Homepage https://github.com/sanekgusev/SGVObjcMixin
License MIT
Platforms ios 7.0, requires ARC
Authors

[![CI Status](http://img.shields.io/travis/Alexander Gusev/SGVObjcMixin.svg?style=flat)](https://travis-ci.org/Alexander Gusev/SGVObjcMixin)

Dynamic class creation and runtime subclassing as a more granular and reversible alternative to method swizzling.

SGVObjcMixin allows to ‘mix in’ instance methods from another class into any existing object (of any class).
The class being mixed in should meet certain requirements, namely:

  • It’s immediate superclass must be in the inheritance hierarchy of the object to be mixed into.
  • It is not allowed to introduce any new ivars (either explicit, or implicit from automatic property synthezation).

This mixin approach can be used as an object-scoped (versus class-scoped), opt-in alternative to method swizzling. It is also arguably easier to reverse at runtime if needed.

Usage

Use the provided SGVObjcMixin category on NSObject to mixin and un-mixin instance methods from other classes.

Requirements

Installation

SGVObjcMixin is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SGVObjcMixin"

Author

Alexander Gusev, [email protected]

License

SGVObjcMixin is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SGVObjcMixin",
    "version": "1.0.0",
    "summary": "Dynamic class creation and runtime subclassing as a more granular and reversible alternative to method swizzling.",
    "description": "                       SGVObjcMixin allows to 'mix in' methods from another class into any existing object (of any class). The class being mixed in should meet certain requirements.n                       This can be used as an object-scoped (versus class-scoped) alternative to method swizzling. It is also arguably easier to reverse at runtime if needed.n",
    "homepage": "https://github.com/sanekgusev/SGVObjcMixin",
    "license": "MIT",
    "authors": {
        "Alexander Gusev": "[email protected]"
    },
    "source": {
        "git": "https://github.com/sanekgusev/SGVObjcMixin.git",
        "tag": "1.0.0"
    },
    "social_media_url": "https://twitter.com/sanekgusev",
    "platforms": {
        "ios": "7.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes",
    "public_header_files": [
        "Pod/Classes/SGVObjcMixinErrors.h",
        "Pod/Classes/NSObject+SGVObjcMixin.h"
    ]
}

Pin It on Pinterest

Share This