Skip to content

Latest commit

 

History

History
125 lines (104 loc) · 3.09 KB

README.md

File metadata and controls

125 lines (104 loc) · 3.09 KB

AMEGetterMaker

A lazyload getter maker without resign

996.icu LICENSE

cn Chinese (Simplified): 中文说明

Version update

  • 1.1.1  
    Add support for type restriction
    Class<ChildClass *> *
  • 1.1.0  
    Add support for swift(test function)
  • 1.0.1  
    Ignore IBOutlet

What is this?

Every time you may use lazyload.However, apple do not provide the method to quickly make getter. So this plug-in may solve your problem.

e.g.

//无视xib
@property (weak, nonatomic) IBOutlet xibSubView *subView;

//无视注释
@property (nonatomic, strong) UIView * view1;
/**
 多行注释也会过滤
 */
@property (nonatomic, strong) UIView * view2;
//assign属性会被过滤
@property (nonatomic, assign) BOOL hahaha;

@property (nonatomic, copy) NSString * sting;

↓↓↓

- (UIView *)view1{
    if(!_view1){
        _view1 = ({
            UIView * object = [[UIView alloc]init];
            object;
       });
    }
    return _view1;
}

- (UIView *)view2{
    if(!_view2){
        _view2 = ({
            UIView * object = [[UIView alloc]init];
            object;
       });
    }
    return _view2;
}

- (NSString *)sting{
    if(!_sting){
        _sting = ({
            NSString * object = [[NSString alloc]init];
            object;
       });
    }
    return _sting;
}

To use in swift


Now support var to lazy var.

e.g.

var button : UIButton!
var button1 : UIButton = UIButton()
var button2 = UIButton()

↓↓↓

lazy var button : UIButton = {
	let object = UIButton()
	return object
}()

lazy var button1 : UIButton = {
	let object = UIButton()
	return object
}()

lazy var button2 : UIButton = {
	let object = UIButton()
	return object
}()

Installation

Xcode8.0+

  1. Download
  2. Enable this plug-in in setting

  3. You can Bind shortcuts in Xcode setting (shift + G)

Xcode7.0

You can use this plug-in -------> getterMake-Xcode

Trouble Shooting

If your Xcode is 8.0+.
Please install macOS Sierra (version 10.12) if your macOS is 10.11.

Special thanks to

hackxhj Give me a lot of inspiration to finish this plug-in

Other project recommendations

AMECategoryMaker
A category property maker without resigin