Skip to content

Instantly share code, notes, and snippets.

@oleksii-demedetskyi
Created March 30, 2015 14:13
Show Gist options
  • Save oleksii-demedetskyi/5a20b4afdee9c6ae76b7 to your computer and use it in GitHub Desktop.
Save oleksii-demedetskyi/5a20b4afdee9c6ae76b7 to your computer and use it in GitHub Desktop.
Result expextation
#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
#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
@oleksii-demedetskyi
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment