GlitchKit - iOS ã§ã«ã¸ã¥ã¢ã«ã«ã°ãªããã§ããã©ã¤ãã©ãª
æ¬æ¥ã社å å¤ã® iOS/Android åã Tips å ±æä¼ã#potatotips 第äºå ã§ããXXXKit -ããã¯ã¯ããã®ãããªç©-ãã¨ããå 容ãçºè¡¨ããã
æè¿ iOS (Objective-C) ã仿´ãªããã«å¦ã³å§ãããã ãã©ãæ°ããäºãå¦ãã§ä»ã¾ã§ç¥ããªãã£ã/è峿·±ããã©ãã¤ã ãããã¨ãããã«ã©ã£ã·ãã¤ãããã¡ã§ãããã ããã°ã©ãã«ãããã¯ãã ãã¨è¨ã£ããããã
ãã®ä¸ã§ããã£ã¦ããã«è峿·±ãã¨æããã®ã¯ Objective-C ã®"ã«ãã´ãª"ã§ãããã¯ãããã import ããã ã(å®é㯠import ããããªãé¢ããããªã³ã¯ãããæ)ã§ãæ§ã ãªãªãã¸ã§ã¯ãã®ã¯ã©ã¹ã®æåãæ¡å¼µã§ãããRuby ã«ããã mixin + refinements ã®ãããªç©ã ããPerl ã§ã use ãã¦ç¹å®ã®ãªãã¸ã§ã¯ãã®æåãå¤ãããã¨ãåºæ¥ãããObjective-C ãå¦ã¶ã¾ã§ããã®ãããªãã¨ãã§ãããã¨ãç¥ããªãã£ãã
ã¾ããã® "ã«ãã´ãª" ã¨çµã¿åããã¦ãæ¨æºã®ãªãã¸ã§ã¯ãã UIKit ã¨ãã£ããã¬ã¼ã ã¯ã¼ã¯ãæ¡å¼µãããã¨ãã§ãã XXXKit ã¨ããèªå°¾ã« Kit ãã¤ããã©ã¤ãã©ãªãããããã¨ãã° EnumeratorKit ãªããã¯ãNSArray ã NSDictionary ã§ãRuby ã® Enumerator çãªã³ã¼ããæ¸ããã¨ãã§ããããã«ãªãããã¡ãããããã¯æå³ããªãåä½ãå¼ãèµ·ããå¯è½æ§ããããããå¤ç¨ããã¨å±éºãªã®ã ããããã¯ä¾¿å©ãã¨ãã¬ã¼ããªããªã®ã§ãã©ããã¦ããªã¬ãªã¬ XXXKit ãä½ããããªãè¡åãã§ã¦ããã
ãã®ããã"ã«ãã´ãª" 㨠"XXXKit" 㯠Objective-C ã«ãããã¯ããã®ãããªãã®ã ãªããã¨æãããã¨è¨ãããã§ã«ãã´ãªä½¿ã£ã¦ Glitch ãã XXXKit ãä½ã£ã¦ã¿ãã
Podfile ã«è¿½å ãã
pod 'GlitchKit'
ã

UIImageView -glitch ã§ã°ãªãã
#import "GlitchKit.h" // glitch! [uiImageView glitch];
ãã

ç°¡å便å©
UIImageView -glitchWithBlock: ã§ã°ãªãã
好ããªããã«ã°ãªããããã
// apply custom glitch [uiImageView glitchWithBlock:^int(int byte, int index, uint length, Byte *bytes) { return (byte == 42 && arc4random() % 3 == 1) ? 0 : byte; }];
ã

ç°¡å便å©
ä»ã«ãUIImage ã¯ã©ã¹ã§ä»¥ä¸ã使ããããã«ãªãã
- (UIImage *)glitch;
- (UIImage )glitchWithBlock: (int (^)(int byte, int index, uint length, Byte bytes)) block;
- (NSData *)glitchData;
- (NSData )glitchDataWithBlock: (int (^)(int byte, int index, uint length, Byte bytes)) block;
ã©ããã«ã¸ã¥ã¢ã«ã«ãããããã ããã