Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions Classes/Features/Annotation/NSObject+annotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,30 @@

#import <Foundation/Foundation.h>

//#define ppx_valid(__KEY__)\
//({\
//if (NO) {\
//[([self.class new]) __KEY__];\
//}\
//})
#define pp_property(object, property) (^{ \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wunreachable-code\"") \
_Pragma("clang diagnostic ignored \"-Wimplicit-retain-self\"") \
return ((void)(NO && ((void)object.property, NO)), @#property); \
_Pragma("clang diagnostic pop") \
}())


#define pp_class_property(class, property) (^{ \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wunreachable-code\"") \
_Pragma("clang diagnostic ignored \"-Wimplicit-retain-self\"") \
return ((void)(NO && ((void)[[class new] property], NO)), @#property); \
_Pragma("clang diagnostic pop") \
}())



//propert annotion define
#define ppx(n, ...) \
+ (NSArray *)annotion_support_##n\
{\
pp_class_property(self, n);\
return @[__VA_ARGS__];\
}

Expand Down
3 changes: 3 additions & 0 deletions Hodor/NSObjectAnnotationTestVC.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@

@interface AnnotationTestObj : NSNumber
@property (nonatomic) NSString *str;
@property (nonatomic) NSString *str2;
@property (nonatomic) id ID;
@property (nonatomic) id ID2;
@property (nonatomic) char c;
@property (nonatomic) char c2;
@property (nonatomic) int *p;
@property (nonatomic) BOOL b;

Expand Down
7 changes: 6 additions & 1 deletion Hodor/NSObjectAnnotationTestVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,18 @@ - (void)func1

}

//ppx(func2_withb_, @{@"j":@"k"})

fpx(func2_withb_, @{@"j":@"k"})
- (void)func2:(int)a withb:(NSString *)b;
{

}

ppx(str2, @(5))
ppx(ID2, @(5))
ppx(c2, @(5))
//ppx(sttr, @(5)) // error
fpx(func3, @(5))
+ (void)func3
{
Expand All @@ -96,7 +102,6 @@ - (void)func4
@implementation AnnotationTestObj2
ppx(str2, @"t");


ppx(func5, @"s");
- (void)func5
{
Expand Down