-
-
Save oleksii-demedetskyi/5a20b4afdee9c6ae76b7 to your computer and use it in GitHub Desktop.
Result expextation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
#define field(__TYPE__, __NAME__) __unsafe_unretained __TYPE__ __NAME__ | |
#define group(__NAME__, __CODE__) struct __CODE__ __NAME__ | |
struct RBGTagSelectionStoryboardIDs | |
{ | |
field(NSString*, name); | |
group(controllers, { | |
field(NSString*, tagList); | |
}); | |
group(cells, { | |
field(NSString*, tagListCell); | |
}); | |
}; | |
#undef field | |
#undef group | |
@class RBGTagListCollectionViewController; | |
@interface RBGTagSelectionStoryboard : UIStoryboard | |
+ (instancetype)new; | |
+ (UIStoryboard *)storyboardWithName:(NSString *)name | |
bundle:(NSBundle *)storyboardBundleOrNil NS_UNAVAILABLE; | |
+ (struct RBGTagSelectionStoryboardIDs)IDs; | |
@property (nonatomic, readonly) struct RBGTagSelectionStoryboardIDs IDs; | |
- (RBGTagListCollectionViewController*)instantiateTagListViewController; | |
@end | |
@interface UIViewController (RBGTagSelectionStoryboard) | |
@property (nonatomic, readonly) RBGTagSelectionStoryboard* rbg_tagSelectionStoryboard; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "RBGTagSelectionStoryboard.h" | |
const struct RBGTagSelectionStoryboardIDs RBGTagSelectionStoryboardIDs = { | |
.name = @"RBGTagSelectionStoryboard", | |
.controllers = { | |
.tagList = @"tag list collection view", | |
}, | |
.cells = { | |
.tagListCell = @"com.robe-guard.tag-list.cell", | |
}, | |
}; | |
@implementation RBGTagSelectionStoryboard | |
+ (instancetype)new | |
{ | |
return (RBGTagSelectionStoryboard*)[super | |
storyboardWithName:self.IDs.name | |
bundle:[NSBundle bundleForClass:[self class]]]; | |
} | |
+ (struct RBGTagSelectionStoryboardIDs)IDs | |
{ | |
return RBGTagSelectionStoryboardIDs; | |
} | |
- (struct RBGTagSelectionStoryboardIDs)IDs | |
{ | |
return [RBGTagSelectionStoryboard IDs]; | |
} | |
- (RBGTagListCollectionViewController*)instantiateTagListViewController; | |
{ | |
return [self instantiateViewControllerWithIdentifier:self.IDs.controllers.tagList]; | |
} | |
@end | |
@implementation UIViewController (RBGTagSelectionStoryboard) | |
- (RBGTagSelectionStoryboard *)rbg_tagSelectionStoryboard | |
{ | |
id sb = self.storyboard; | |
if ([sb isKindOfClass:[RBGTagSelectionStoryboard class]]) { | |
return sb; | |
} | |
return nil; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Another implementations:
https://bitbucket.org/nut_code_monkey/ssgenerator
https://github.com/kluivers/storyboard-constants