Xcode Plugin ãçãä¸ãã£ã¦ããããã
ãã°ããåã«ç°¡åãªãã¬ã¼ã³è³æãä½ã£ã¦ä¸é¨ã®äººã«ããã°ã«æ¸ãæ¸ãè©æ¬ºããã¦ããã®ã§ã以ä¸ã®ã¯ã©ã¹ã¡ã½ããããã®è¨äºã«ä¾¿ä¹ãã¦æ¸ãã¦ãããã¨æãã¾ãã
- åãã¦ã®Xcode 5 ãã©ã°ã¤ã³éçº ï½ Developers.IO
- Xcode 5 ãã©ã°ã¤ã³ éçºã®ãã¯ããã¯ ï½ Developers.IO
åºæ¬çã«ã¯éè¤ãã¦ããèªåã®ã¨ã³ããªã®æ¹ãé©å½ãªã®ã§ã¯ã©ã¹ã¡ã½ããããã®è¨äºãåç §ãã¦ãã ããã
Xcode Plugin ã¨ã¯
- Xcode ã¯å
ã
ããèªèº«ãè¤æ°ã® Plugin ã®å¡
- Xcode 5.0.1 å é¨ã«ã¯ 54 åã® Plugin ããã
- 3rd Perty ãåæã«ãã® Plugin ã®ä»çµã¿ã使ã£ã¦èªèº«ã®ã³ã¼ãã Xcode ã«ãã¼ãããããã¨ã§èªåã欲ããæ©è½ã追å ãã¦ããã
- å ¬å¼ãªæ¹æ³ã§ã¯ãªããã API ã¯ãªãã
- ãã®ãã®ãæ¢ãã ãã¦è¿½å ãã
- ãã®ãããã¯ç§ãæä½ã£ã¦ãã Safari ç¨ã® SIMBL ãã©ã°ã¤ã³ã¨åã
ãã¼ãã®ä»çµã¿
Info.plist ã® "Principal class" ã«èªã¿è¾¼ãã§ãããããã¯ã©ã¹åãè¨è¼ãã¾ãããããã¨ã³ããªãã¤ã³ãã¨ãªãã¾ããPrincipal class ã¨ãªãã¯ã©ã¹ã® + pluginDidLoad:(NSBundle *)plugin
ã¡ã½ãããå®è£
ãã¾ããããã§ã¤ã³ã¹ã¿ã³ã¹ãçæãã¦ã´ãã§ã´ãã§ã¨ããæãã§ãã
ã
ã¨ãã¯é¢åãããã®ã§ä»¥ä¸ã®ä¾¿å©ãªãã³ãã¬ãçµã¿è¾¼ãã§ããããæ°è¦ããã¸ã§ã¯ããä½æããã¨ãã« Xcode Plugin ã®ã²ãªå½¢ãã§ããã§ãã£ã¡ã®æ¹ã楽ã ã¨æãã¾ããããã§ãã«ãããã ã㧠Menu ã®ä¸ã«ç¬èªå®ç¾©ã®ã¡ãã¥ã¼ã足ããã¾ãã
ã©ãã«ä½ãã©ããã£ã¦è¶³ã
- class-dump
- otool
ã¨ãã使ã£ã¦ Xcode ã«ããã¯ã©ã¹ãã¡ã½ãããããã£ã¨æ¸ãåºãã¦ããããããã¯ã©ã¹ãã¡ã½ãããæ¢ãã 試ãã¾ãããã®ããã㯠Cocoa å ¨è¬ã®ç¥èããã©ã°ã¤ã³ä½æçµé¨ãçãã¦ããä½æ¥ã§ãã
èªå㧠class-dump ããã®ãé¢åãããã®ã§ãããåç §
ãã¨ã¯æ¢ã« Xcode Plugin ãå¤æ°åºã¦ããããããã®ã½ã¼ã¹ã³ã¼ãã¯ããã¦ã Github ã«ä¸ãã£ã¦ãããèªåããããããã¨ã¨ä¼¼ã¦ãããã¨ããã£ã¦ããã®ãæ¢ãã¦ã³ã¼ãèªãã£ã¦æãã§ãã
ä»åä½ã£ããã¤
- Xcode ã®ã³ã³ã½ã¼ã«ã«åºåããã¦ããããã¹ãã
- ããã¸ã§ã¯ãåï¼æ¥æ ãªãã¡ã¤ã«ã¨ãã¦æ¸ãåºã
- ããã ãã
ãããã©ããã Tips
iOS éçºè è¦ç¹ã§ã
Xcode ã¯ãã«ãã¦ã£ã³ãã¦
ãã©ã°ã¤ã³ã®ãã¼ãã¯1åã ãã©ã¦ã¤ã³ãã¦ã¯è¤æ°ãã
- ã¦ã¤ã³ãã¦ã«è¶³ãã UI ã®ã¤ã³ã¹ã¿ã³ã¹ãããããã£ã¨ãã§ãã®ã¾ã¾æã¤ã¨ãããããªã
- ã¦ã¤ã³ãã¦ãã¨ã«ãã©ã°ã¤ã³å´ã§ç¬èªã«ç®¡çãããé½åº¦åå¾ã§å¯¾å¦ã
- ä»åã¯ã¦ã¤ã³ãã¦ãã¢ã¯ãã£ãã«ãªã£ãã¿ã¤ãã³ã°ã§å¿ è¦ãªã¤ã³ã¹ã¿ã³ã¹ãåå¾ã
- Xcode å´ã«è¶³ãã UI 㯠tag ã§ç®¡çãã¦,åå¨ããªããã°è¿½å ããæãã§å¯¾å¦ã
UserDefaults ã¯è¦ªã®ç©
ã¡ãã£ã¨ããæ å ±ãä¿åãããã¨ãã®å ¸å
[[NSUserDefaults standardUserDefaluts] setObject:è¨å®æ å ± forKey:ãªããè¨å®];
ãããããã¨ã©ãã«ä¿åãããã¨æãã¾ããï¼
ãã㯠Xcode ã® Preference ã«ä¿åããã¾ãã
~/Library/Preferences/com.apple.dt.Xcode.plist
- åæãã©ã°ã¤ã³ã親㮠Preference æ±ãã£ã¦ãã¡ã ã
- ã¢ã³ã¤ã³ã¹ãã¼ã«ãã¦ã com.apple.dt.Xcode.plist ã«æ®ã£ã¦ã
ã»ã¨ãã©ã® Xcode Plugin ã¯æ®éã« Defaults ã«æ¸ãã¦ãã¾ã£ã¦ããã§ãããè¡åãæªãã®ã§èªåã®ãã©ã°ã¤ã³ç¨ã® plist ãç¨æãã¦ããã«è¨å®æ å ±ãæ¸ãè¾¼ã¿ã¾ãããã
[NSBundle bundleForClass:[self class]];
ããã§èªåã®Bundleã®ã¤ã³ã¹ã¿ã³ã¹ãã¨ããã®ã§
NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); NSString *path = nil; if ([paths count]) { NSString *lastPathComponent = [[bundle bundlePath] lastPathComponent]; NSString *filepath = [NSString stringWithFormat:@"%@/%@.plist", [lastPathComponent stringByDeletingPathExtension], [bundle bundleIdentifier]]; path = [[paths objectAtIndex: 0] stringByAppendingPathComponent:filepath]; }
ã¨ãã§
~/Library/Application Support/ãã©ã°ã¤ã³å/ãã©ã°ã¤ã³å.plist
ã¨ãããã¹ãã¨ãã¾ããXcode ã®ãã¼ã¸ã§ã³ã«ãã£ã¦å¾®å¦ã«éãã¡ã¤ã³ã«ãªã£ãããªããªãã£ãããã¦ã¾ãããã
ãã¨ã¯é©å½ã« NSMutableDictionary ã«å¤çªã£è¾¼ã㧠writeToFile:atomically: ã§æ¸ãè¾¼ãã°ããã¨æãã¾ããNSUserDefaults ã§ãã£ã¨ã¨ã¬ã¬ã³ãã«æ¸ããæ¹æ³ãããæ°ãããªãã§ããªãã§ããã©ã
Key ã¤ãã³ãã£ã¦çµæ§ç°¡åã«ã¨ãããã§ãã
NSWindow ã® sendEvent: ã¨ã Swizzling ããªãã¨ã¨ããªãã®ãã¨æã£ã¦ã¾ããã
NSEvent + (id)addLocalMonitorForEventsMatchingMask:(NSEventMask)mask handler:(NSEvent* (^)(NSEvent*))block NS_AVAILABLE_MAC(10_6);
ã§èªèº«ã®ã¢ããªãã¢ã¯ãã£ããªæã«ç»é²ãã種é¡ã®ã¤ãã³ãã ã handler ãå¼ã°ãã¾ããæãSwizzling ã§é å¼µã£ã¦ãã®ã«ãã¤ã®éã«ããããªä¾¿å©ãªæ©è½ã足ããã¦ã¾ããã
ã¨ãããã¨ã§
ã¿ããªãã©ãã©ã Xcode Plugin ãä½ã£ã¦å¿«é©ãªã³ã¼ãã£ã³ã°ããã¾ãããã ãã㦠Xcode ã® Defaults ã¯æ±ããã«ããã¾ãããã