Skip to content

Instantly share code, notes, and snippets.

@sartak
Last active August 29, 2015 13:56
Show Gist options
  • Save sartak/8796085 to your computer and use it in GitHub Desktop.
Save sartak/8796085 to your computer and use it in GitHub Desktop.
#import <SpriteKit/SpriteKit.h>
@interface SKTexture (YWName)
@property (nonatomic, strong) NSString *yw_textureName;
@property (nonatomic, strong) NSString *yw_atlasName;
@end
#import "SKTexture+YWName.h"
#import <objc/runtime.h>
static char const * const YWAtlasNameKey;
static char const * const YWTextureNameKey;
@implementation SKTexture (YWName)
-(void)setYw_atlasName:(NSString *)yw_atlasName {
objc_setAssociatedObject(self, &YWAtlasNameKey, yw_atlasName, OBJC_ASSOCIATION_RETAIN);
}
-(void)setYw_textureName:(NSString *)yw_textureName {
objc_setAssociatedObject(self, &YWTextureNameKey, yw_textureName, OBJC_ASSOCIATION_RETAIN);
}
-(NSString *)yw_atlasName {
return objc_getAssociatedObject(self, &YWAtlasNameKey);
}
-(NSString *)yw_textureName {
return objc_getAssociatedObject(self, &YWTextureNameKey);
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment