/DVAutoGeneratedProperties

Subclass to get auto generated properties

Primary LanguageObjective-CMIT LicenseMIT

DVAutoGeneratedProperties

CI Status Version License Platform

Do you have classes like UserDefaultsAdapter and KeychainAdapter that has a lot of duplicated code? This library offers you a solution.

There's a 3 steps to make it work:

  1. Subclass DVAutoGeneratedProperties
  2. Override setter and getter block methods
  3. Add as much class properties as you want

Example

General setter implementation:

+ (dvPropertySetterBlock)setterBlockForTarget:(id)target getterSelector:(SEL)getterSelector {
    return ^(id blockSelf, id value) {
        // your code here
    };
}

General getter implementation:

+ (dvPropertyGetterBlock)getterBlockForTarget:(id)target getterSelector:(SEL)getterSelector {
    return ^id(id blockSelf) {
        return // your code here
    };
}

If you want real usage example, check the implementation of NSUserDefaults facade.

Installation

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

pod 'DVAutoGeneratedProperties'

Author

vdugnist, vdugnist@gmail.com

License

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