iOS module dir
This commit is contained in:
16
iOS/Pod/Classes/Shader/DoricGroupNode.h
Normal file
16
iOS/Pod/Classes/Shader/DoricGroupNode.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// DoricGroupNode.h
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricViewNode.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricGroupNode : DoricViewNode<UIView *>
|
||||
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutconfig;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
23
iOS/Pod/Classes/Shader/DoricGroupNode.m
Normal file
23
iOS/Pod/Classes/Shader/DoricGroupNode.m
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// DoricGroupNode.m
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricGroupNode.h"
|
||||
|
||||
@implementation DoricGroupNode
|
||||
|
||||
- (UIView *)build:(NSDictionary *)props {
|
||||
return [[UIView alloc] init];
|
||||
}
|
||||
|
||||
- (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop {
|
||||
|
||||
}
|
||||
|
||||
- (void)blendChild:(DoricViewNode *)child layoutConfig:(NSDictionary *)layoutconfig {
|
||||
|
||||
}
|
||||
@end
|
16
iOS/Pod/Classes/Shader/DoricHLayoutNode.h
Normal file
16
iOS/Pod/Classes/Shader/DoricHLayoutNode.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// DoricHLayoutNode.h
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricGroupNode.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricHLayoutNode : DoricGroupNode
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
iOS/Pod/Classes/Shader/DoricHLayoutNode.m
Normal file
12
iOS/Pod/Classes/Shader/DoricHLayoutNode.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// DoricHLayoutNode.m
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricHLayoutNode.h"
|
||||
|
||||
@implementation DoricHLayoutNode
|
||||
|
||||
@end
|
16
iOS/Pod/Classes/Shader/DoricStackNode.h
Normal file
16
iOS/Pod/Classes/Shader/DoricStackNode.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// DoricStackNode.h
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricGroupNode.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricStackNode : DoricGroupNode
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
iOS/Pod/Classes/Shader/DoricStackNode.m
Normal file
12
iOS/Pod/Classes/Shader/DoricStackNode.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// DoricStackNode.m
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricStackNode.h"
|
||||
|
||||
@implementation DoricStackNode
|
||||
|
||||
@end
|
16
iOS/Pod/Classes/Shader/DoricVLayoutNode.h
Normal file
16
iOS/Pod/Classes/Shader/DoricVLayoutNode.h
Normal file
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// DoricVLayoutNode.h
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricGroupNode.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DoricVLayoutNode : DoricGroupNode
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
iOS/Pod/Classes/Shader/DoricVLayoutNode.m
Normal file
12
iOS/Pod/Classes/Shader/DoricVLayoutNode.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// DoricVLayoutNode.m
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricVLayoutNode.h"
|
||||
|
||||
@implementation DoricVLayoutNode
|
||||
|
||||
@end
|
29
iOS/Pod/Classes/Shader/DoricViewNode.h
Normal file
29
iOS/Pod/Classes/Shader/DoricViewNode.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// DoricViewNode.h
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricContextHolder.h"
|
||||
|
||||
#import "UIView+Doric.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class DoricGroupNode;
|
||||
|
||||
@interface DoricViewNode <V>: DoricContextHolder
|
||||
|
||||
@property (nonatomic,strong) V view;
|
||||
|
||||
@property (nonatomic,weak) DoricGroupNode *parent;
|
||||
|
||||
- (V)build:(NSDictionary *)props;
|
||||
|
||||
- (void)blend:(NSDictionary *)props;
|
||||
|
||||
- (void)blendView:(V)view forPropName:(NSString *)name propValue:(id)prop;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
46
iOS/Pod/Classes/Shader/DoricViewNode.m
Normal file
46
iOS/Pod/Classes/Shader/DoricViewNode.m
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// DoricViewNode.m
|
||||
// Doric
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/7/30.
|
||||
//
|
||||
|
||||
#import "DoricViewNode.h"
|
||||
#import "DoricUtil.h"
|
||||
#import "DoricGroupNode.h"
|
||||
|
||||
@implementation DoricViewNode
|
||||
|
||||
- (UIView *)build:(NSDictionary *)props {
|
||||
return [[UIView alloc] init];
|
||||
}
|
||||
|
||||
- (void)blend:(NSDictionary *)props {
|
||||
if(self.view == nil) {
|
||||
self.view = [self build:props];
|
||||
}
|
||||
for (NSString *key in props) {
|
||||
id value = props[key];
|
||||
[self blendView:self.view forPropName:key propValue:value];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)blendView:(UIView *)view forPropName:(NSString *)name propValue:(id)prop {
|
||||
if([name isEqualToString:@"width"]) {
|
||||
view.width = [(NSNumber *)prop floatValue];
|
||||
} else if([name isEqualToString:@"height"]) {
|
||||
view.height = [(NSNumber *)prop floatValue];
|
||||
} else if([name isEqualToString:@"x"]) {
|
||||
view.x = [(NSNumber *)prop floatValue];
|
||||
} else if([name isEqualToString:@"y"]) {
|
||||
view.y = [(NSNumber *)prop floatValue];
|
||||
} else if([name isEqualToString:@"bgColor"]) {
|
||||
view.backgroundColor = DoricColor(prop);
|
||||
} else if([name isEqualToString:@"layoutConfig"]) {
|
||||
if(self.parent && [prop isKindOfClass:[NSDictionary class]]){
|
||||
[self.parent blendChild:self layoutConfig:prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
Reference in New Issue
Block a user