Latest 2.0.2
Homepage https://github.com/kuah/KAutoProperty
License MIT
Platforms ios 8.0, requires ARC
Dependencies YYKit, KRunTime
Frameworks UIKit

自动填充配置属性

Preface

你的代码只要是符合国家标准,少用xib的话。那么,你肯定遇到下面绝望的情况~~~ 那么,这个库就能很大程度上帮到你~!

    self.headImageView = [UIImageView new];
    self.userNameLabel = [UILabel new];
    self.sex_ageView = [UIButton new];
    self.sexImageView= [UIImageView new];
    self.ageLabel = [UILabel new];
    self.arrowImageView = [UIImageView new];
    self.topView = [UIView new];
    self.actionLabel = [UILabel new];
    self.groupNameLabel = [UILabel new];
    self.timeLabel = [UILabel new];
    self.descLabel = [UILabel new];
    line1 = [UIView new];
    self.refuseButton = [UIButton new];
    self.agreeButton = [UIButton new];
    self.contentView = [UIView new];

Example

#import "ViewController.h"
#import "NSObject+KuahAutoProperty.h"
@protocol a @end
@interface ViewController ()
@property (nonatomic,strong)UIView <kap,a> *testview;
@property (nonatomic,strong)NSMutableArray $$ *marr;
@property (nonatomic,strong)NSArray $$ *arr;
@property (nonatomic,strong)UITextView <kap> *textView;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self kap];

    [self.marr addObject:@"a"];
    NSLog(@"%@",self.marr);
    self.textView.text = @"1";
    NSLog(@"%@",self.textView.text);
}
@end

Install

pod 'KAutoProperty'

Usage

导入头文件

#import "NSObject+KuahAutoProperty.h"

遵循协议

使用 $$<kap>

@property (nonatomic,strong)NSArray $$ *arr;
@property (nonatomic,strong)UITextView <kap> *textView;

调用kap,一键加载

kap方法可以放在自己喜欢的位置调用,但应该在属性还没加载还没有任何操作的时刻去调用

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self kap];
}

Latest podspec

{
    "name": "KAutoProperty",
    "version": "2.0.2",
    "summary": "u4e00u952eu61d2u52a0u8f7d",
    "homepage": "https://github.com/kuah/KAutoProperty",
    "authors": "CT4 => [email protected]",
    "source": {
        "git": "https://github.com/kuah/KAutoProperty.git",
        "tag": "yykit2.0.2"
    },
    "source_files": "source/**/*.{h,m}",
    "requires_arc": true,
    "libraries": "z",
    "platforms": {
        "ios": "8.0"
    },
    "license": "MIT",
    "frameworks": "UIKit",
    "dependencies": {
        "YYKit": [
            "~> 1.0.9"
        ],
        "KRunTime": [
            "~> 0.2"
        ]
    }
}

Pin It on Pinterest

Share This