名字没想好,就暂且叫它 husky
写 husky 动机
自 Masonry 的横空出世,其链式编程的姿势屡试不爽,相比于iOS的书写姿势更见其🐂, Masonry 中能实现这种链式编程方式那么iOS控件创建也一定能实现这种方式,在看完其内部实现后,在闲余时间决定自己将 UIKit 重写一遍达到其一样的效果,希望在开发过程中对开发效率和代码的可读性有一定的帮助。
husky 引入
-
pod husky -
直接下载引用
导入头文件 #import <husky/husky.h>
用法示例
控件创建🌰
[UILabel generator:^(huskyer * _Nonnull huskyer) {
maker.frame(CGRectMake(100, 100, 100, 30)).text(@"哈哈").textAlignment(NSTextAlignmentCenter).textColor([UIColor whiteColor]).view(self.view).backGroudColor([UIColor redColor]).radian(CGSizeMake(25, 25)).husker(^{
NSLog(@"click");
});
}];
网络数据请求🌰
[self patch:^(Patcher * _Nonnull patcher) {
patcher.role(UIPatcherRoleGet).url(@"https://zhqd.shiminjia.com/weather.php").indicator(YES);
[patcher send:^(id _Nonnull respone) {
NSLog(@"respone---%@",respone);
}];
}];
版本设计基线
husky 中几乎涵盖了日常开发过程中用到的对象,后期还会增加一些拓展,也期盼您有更好的想法为其拓展。
期待更好想法
如果您有更多好的设计和想法,可以加入我们~