├── AutoGenerateDescriptionPluginProd ├── .DS_Store ├── AutoGenerateDescriptionPluginProd │ ├── header.png │ ├── screenshot.png │ ├── implementation.png │ ├── alcatrazscreenshot.png │ ├── AutoGenerateDescriptionPluginProd.h │ ├── DescriptionGenerator.h │ ├── AutoGenerateDescriptionPluginProd.pch │ ├── DTXcodeUtils.h │ ├── DTXcodeHeaders.h │ ├── Info.plist │ ├── AutoGenerateDescriptionPluginProd.m │ ├── DTXcodeUtils.m │ ├── DescriptionGenerator.m │ ├── RegExCategories.m │ └── RegExCategories.h └── AutoGenerateDescriptionPluginProd.xcodeproj │ ├── project.xcworkspace │ └── contents.xcworkspacedata │ ├── xcshareddata │ └── xcschemes │ │ └── AutoGenerateDescriptionPluginProd.xcscheme │ └── project.pbxproj ├── .gitignore └── README.md /AutoGenerateDescriptionPluginProd/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamontherun/xCodeGenerateDescriptionPlugin/HEAD/AutoGenerateDescriptionPluginProd/.DS_Store -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamontherun/xCodeGenerateDescriptionPlugin/HEAD/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/header.png -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamontherun/xCodeGenerateDescriptionPlugin/HEAD/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/screenshot.png -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/implementation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamontherun/xCodeGenerateDescriptionPlugin/HEAD/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/implementation.png -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/alcatrazscreenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamontherun/xCodeGenerateDescriptionPlugin/HEAD/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/alcatrazscreenshot.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### Xcode ### 2 | build/ 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | xcuserdata 12 | *.xccheckout 13 | profile 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd.h: -------------------------------------------------------------------------------- 1 | // 2 | // AutoGenerateDescriptionPluginProd.h 3 | // AutoGenerateDescriptionPluginProd 4 | // 5 | // Created by adam smith on 2/17/15. 6 | // Copyright (c) 2015 adam smith. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AutoGenerateDescriptionPluginProd : NSObject 12 | 13 | + (instancetype)sharedPlugin; 14 | 15 | @property (nonatomic, strong, readonly) NSBundle* bundle; 16 | @end -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/DescriptionGenerator.h: -------------------------------------------------------------------------------- 1 | // 2 | // DescriptionGenerator.h 3 | // AutoGenerateDescriptionPluginProd 4 | // 5 | // Created by adam smith on 2/17/15. 6 | // Copyright (c) 2015 adam smith. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "RegExCategories.h" 11 | #import "DTXcodeHeaders.h" 12 | #import "DTXcodeUtils.h" 13 | 14 | @interface DescriptionGenerator : NSObject 15 | 16 | - (void)generateDescription; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd.pch: -------------------------------------------------------------------------------- 1 | // 2 | // global.pch 3 | // AutoGenerateDescriptionPluginProd 4 | // 5 | // Created by adam smith on 2/17/15. 6 | // Copyright (c) 2015 adam smith. All rights reserved. 7 | // 8 | 9 | #ifndef AutoGenerateDescriptionPluginProd_global_pch 10 | #define AutoGenerateDescriptionPluginProd_global_pch 11 | #import 12 | 13 | // Include any system framework and library headers here that should be included in all compilation units. 14 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/DTXcodeUtils.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @class DVTSourceTextView; 5 | @class DVTTextStorage; 6 | @class IDEEditor; 7 | @class IDEEditorArea; 8 | @class IDESourceCodeDocument; 9 | @class IDEEditorContext; 10 | @class IDEWorkspaceWindowController; 11 | 12 | @interface DTXcodeUtils : NSObject 13 | + (NSWindow *)currentWindow; 14 | + (NSResponder *)currentWindowResponder; 15 | + (NSMenu *)mainMenu; 16 | + (IDEWorkspaceWindowController *)currentWorkspaceWindowController; 17 | + (IDEEditorArea *)currentEditorArea; 18 | + (IDEEditorContext *)currentEditorContext; 19 | + (IDEEditor *)currentEditor; 20 | + (IDESourceCodeDocument *)currentSourceCodeDocument; 21 | + (DVTSourceTextView *)currentSourceTextView; 22 | + (DVTTextStorage *)currentTextStorage; 23 | + (NSScrollView *)currentScrollView; 24 | + (NSArray *)getCurrentClassNameByCurrentSelectedRange; 25 | + (NSString *)getDotMFilePathOfCurrentEditFile; 26 | + (BOOL)openFile:(NSString *)filePath; 27 | + (NSRange)getClassImplementContentRangeWithClassName:(NSString *)className mFileText:(NSString *)mFileText; 28 | 29 | + (NSMenuItem *)getMainMenuItemWithTitle:(NSString *)title; 30 | + (NSRange)getInsertRangeWithClassImplementContentRange:(NSRange)range; 31 | @end 32 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # xCodeGenerateDescriptionPlugin 2 | Xcode plugin to automatically override the description method for your class. Because overriding the description method is really helpful in debugging, but doing it by hand takes forever. 3 | 4 | ## Install 5 | #### Via Alcatraz (preferred) 6 | ![alcatraz screenshot](https://github.com/adamontherun/xCodeGenerateDescriptionPlugin/blob/master/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/alcatrazscreenshot.png) 7 | 8 | #### Manually 9 | 10 | Download source code and run the project. The plugin will be automatically installed 11 | 12 | Restart Xcode regardless of install method. 13 | 14 | ## Usage 15 | 1. In the .h file of your class, select all the properties you want included in your - (NSString *)description method. 16 | 2. In the edit menu select Make Description 17 | 3. Plugin will do all the work for you. 18 | 19 | .h 20 | ![.h file](https://github.com/adamontherun/xCodeGenerateDescriptionPlugin/blob/master/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/header.png) 21 | .m 22 | ![.m file](https://github.com/adamontherun/xCodeGenerateDescriptionPlugin/blob/master/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/implementation.png) 23 | 24 | ####Notes 25 | 1. Any property that's commented out with a // will not be included in the description 26 | 2. Properties can have comments trailing them, such as @property (nonatomic) NSString *name; //el nombre 27 | -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/DTXcodeHeaders.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface DVTTextStorage : NSTextStorage 5 | /** Whether to syntax highlight the current editor */ 6 | @property(getter=isSyntaxColoringEnabled) BOOL syntaxColoringEnabled; 7 | 8 | /** Converts from a character number in the text to a line number */ 9 | - (NSRange)lineRangeForCharacterRange:(NSRange)characterRange; 10 | 11 | /** Converts from a line number in the text to a character number */ 12 | - (NSRange)characterRangeForLineRange:(NSRange)lineRange; 13 | @end 14 | 15 | @interface DVTCompletingTextView : NSTextView 16 | @end 17 | 18 | @interface DVTSourceTextView : DVTCompletingTextView 19 | @end 20 | 21 | @interface DVTViewController : NSViewController 22 | @end 23 | 24 | @interface IDEViewController : DVTViewController 25 | @end 26 | 27 | @class IDEEditorContext; 28 | @interface IDEEditorArea : IDEViewController 29 | @property(retain, nonatomic) IDEEditorContext *lastActiveEditorContext; 30 | @end 31 | 32 | @interface IDEEditor : IDEViewController 33 | @end 34 | 35 | @interface IDEEditorContext : IDEViewController 36 | @property(retain, nonatomic) IDEEditor *editor; 37 | @property(retain, nonatomic) IDEEditorArea *editorArea; 38 | @end 39 | 40 | @interface IDEEditorDocument : NSDocument 41 | @end 42 | 43 | @interface IDESourceCodeDocument : IDEEditorDocument 44 | @end 45 | 46 | @interface IDESourceCodeEditor : IDEEditor 47 | @property(readonly) IDESourceCodeDocument *sourceCodeDocument; 48 | @property(retain) DVTSourceTextView *textView; 49 | @end 50 | 51 | @interface IDEComparisonEditor : IDEEditor 52 | @property(retain) IDEEditorDocument *secondaryDocument; 53 | @property(retain) IDEEditorDocument *primaryDocument; 54 | @end 55 | 56 | @interface IDESourceCodeComparisonEditor : IDEComparisonEditor 57 | @property(readonly) DVTSourceTextView *keyTextView; 58 | @end 59 | 60 | @interface IDEWorkspaceWindowController : NSWindowController 61 | @property(readonly) IDEEditorArea *editorArea; 62 | @end -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | adamontherun.autoGenerateDescription 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | DVTPlugInCompatibilityUUIDs 26 | 27 | 9F75337B-21B4-4ADC-B558-F9CADF7073A7 28 | FEC992CC-CA4A-4CFD-8881-77300FCB848A 29 | C4A681B0-4A26-480E-93EC-1218098B9AA0 30 | AD68E85B-441B-4301-B564-A45E4919A6AD 31 | A2E4D43F-41F4-4FB9-BB94-7177011C9AED 32 | 640F884E-CE55-4B40-87C0-8869546CAB7A 33 | 37B30044-3B14-46BA-ABAA-F01000C27B63 34 | A16FF353-8441-459E-A50C-B071F53F51B7 35 | E969541F-E6F9-4D25-8158-72DC3545A6C6 36 | 992275C1-432A-4CF7-B659-D84ED6D42D3F 37 | CC0D0F4F-05B3-431A-8F33-F84AFCB2C651 38 | 0420B86A-AA43-4792-9ED0-6FE0F2B16A13 39 | 8DC44374-2B35-4C57-A6FE-2AD66A36AAD9 40 | AABB7188-E14E-4433-AD3B-5CD791EAD9A3 41 | 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 42 | CC0D0F4F-05B3-431A-8F33-F84AFCB2C651 43 | 7265231C-39B4-402C-89E1-16167C4CC990 44 | 9AFF134A-08DC-4096-8CEE-62A4BB123046 45 | F41BD31E-2683-44B8-AE7F-5F09E919790E 46 | 47 | LSMinimumSystemVersion 48 | $(MACOSX_DEPLOYMENT_TARGET) 49 | NSPrincipalClass 50 | AutoGenerateDescriptionPluginProd 51 | XC4Compatible 52 | 53 | XCPluginHasUI 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd.m: -------------------------------------------------------------------------------- 1 | // 2 | // AutoGenerateDescriptionPluginProd.m 3 | // AutoGenerateDescriptionPluginProd 4 | // 5 | // Created by adam smith on 2/17/15. 6 | // Copyright (c) 2015 adam smith. All rights reserved. 7 | // 8 | 9 | #import "AutoGenerateDescriptionPluginProd.h" 10 | #import "DescriptionGenerator.h" 11 | 12 | static AutoGenerateDescriptionPluginProd *sharedPlugin; 13 | 14 | @interface AutoGenerateDescriptionPluginProd() 15 | 16 | @property (nonatomic, strong, readwrite) NSBundle *bundle; 17 | @end 18 | 19 | @implementation AutoGenerateDescriptionPluginProd 20 | 21 | + (void)pluginDidLoad:(NSBundle *)plugin 22 | { 23 | static dispatch_once_t onceToken; 24 | NSString *currentApplicationName = [[NSBundle mainBundle] infoDictionary][@"CFBundleName"]; 25 | if ([currentApplicationName isEqual:@"Xcode"]) { 26 | dispatch_once(&onceToken, ^{ 27 | sharedPlugin = [[self alloc] initWithBundle:plugin]; 28 | }); 29 | } 30 | } 31 | 32 | + (instancetype)sharedPlugin 33 | { 34 | return sharedPlugin; 35 | } 36 | 37 | - (id)initWithBundle:(NSBundle *)plugin 38 | { 39 | if (self = [super init]) { 40 | // reference to plugin's bundle, for resource access 41 | self.bundle = plugin; 42 | 43 | // Create menu items, initialize UI, etc. 44 | 45 | if ([[NSApplication sharedApplication] mainMenu] != nil) { 46 | [self insertItemMenu]; 47 | } else { 48 | [[NSApplication sharedApplication] addObserver:self forKeyPath:@"mainMenu" options:NSKeyValueObservingOptionNew context:NULL]; 49 | } 50 | } 51 | return self; 52 | } 53 | 54 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 55 | if ([keyPath isEqualToString:@"mainMenu"]) { 56 | [self insertItemMenu]; 57 | } 58 | } 59 | 60 | - (void)insertItemMenu { 61 | static dispatch_once_t onceToken; 62 | dispatch_once(&onceToken, ^{ 63 | NSMenuItem *actionMenuItem = [[NSMenuItem alloc] initWithTitle:@"Make Description" action:@selector(doMenuAction) keyEquivalent:@"p"]; 64 | [actionMenuItem setTarget:self]; 65 | [actionMenuItem setKeyEquivalentModifierMask:NSControlKeyMask]; 66 | 67 | NSMenuItem *menuItem = [[NSApp mainMenu] itemWithTitle:@"Edit"]; 68 | [[menuItem submenu] addItem:[NSMenuItem separatorItem]]; 69 | [[menuItem submenu] addItem:actionMenuItem]; 70 | }); 71 | } 72 | 73 | // Sample Action, for menu item: 74 | - (void)doMenuAction 75 | { 76 | DescriptionGenerator *generator = [DescriptionGenerator new]; 77 | [generator generateDescription]; 78 | } 79 | 80 | - (void)dealloc 81 | { 82 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 83 | } 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd.xcodeproj/xcshareddata/xcschemes/AutoGenerateDescriptionPluginProd.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 46 | 47 | 58 | 60 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/DTXcodeUtils.m: -------------------------------------------------------------------------------- 1 | #import "DTXcodeUtils.h" 2 | 3 | #import "DTXcodeHeaders.h" 4 | 5 | @implementation DTXcodeUtils 6 | 7 | + (NSWindow *)currentWindow { 8 | return [[NSApplication sharedApplication] keyWindow]; 9 | } 10 | 11 | + (NSResponder *)currentWindowResponder { 12 | return [[self currentWindow] firstResponder]; 13 | } 14 | 15 | + (NSMenu *)mainMenu { 16 | return [NSApp mainMenu]; 17 | } 18 | 19 | + (NSMenuItem *)getMainMenuItemWithTitle:(NSString *)title { 20 | return [[self mainMenu] itemWithTitle:title]; 21 | } 22 | 23 | + (IDEWorkspaceWindowController *)currentWorkspaceWindowController { 24 | NSLog(@"getting window controller"); 25 | NSWindowController *result = [self currentWindow].windowController; 26 | if ([result isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) { 27 | return (IDEWorkspaceWindowController *)result; 28 | } 29 | return nil; 30 | } 31 | 32 | + (IDEEditorArea *)currentEditorArea { 33 | return [self currentWorkspaceWindowController].editorArea; 34 | } 35 | 36 | + (IDEEditorContext *)currentEditorContext { 37 | return [self currentEditorArea].lastActiveEditorContext; 38 | } 39 | 40 | + (IDEEditor *)currentEditor { 41 | return [self currentEditorContext].editor; 42 | } 43 | 44 | + (IDESourceCodeDocument *)currentSourceCodeDocument { 45 | if ([[self currentEditor] isKindOfClass:NSClassFromString(@"IDESourceCodeEditor")]) { 46 | return ((IDESourceCodeEditor *)[self currentEditor]).sourceCodeDocument; 47 | } else if ([[self currentEditor] isKindOfClass: 48 | NSClassFromString(@"IDESourceCodeComparisonEditor")]) { 49 | IDEEditorDocument *document = 50 | ((IDESourceCodeComparisonEditor *)[self currentEditor]).primaryDocument; 51 | if ([document isKindOfClass:NSClassFromString(@"IDESourceCodeDocument")]) { 52 | return (IDESourceCodeDocument *)document; 53 | } 54 | } 55 | return nil; 56 | } 57 | 58 | + (DVTSourceTextView *)currentSourceTextView { 59 | if ([[self currentEditor] isKindOfClass:NSClassFromString(@"IDESourceCodeEditor")]) { 60 | return ((IDESourceCodeEditor *)[self currentEditor]).textView; 61 | } else if ([[self currentEditor] isKindOfClass: 62 | NSClassFromString(@"IDESourceCodeComparisonEditor")]) { 63 | return ((IDESourceCodeComparisonEditor *)[self currentEditor]).keyTextView; 64 | } 65 | return nil; 66 | } 67 | 68 | + (DVTTextStorage *)currentTextStorage { 69 | NSTextView *textView = [self currentSourceTextView]; 70 | if ([textView.textStorage isKindOfClass:NSClassFromString(@"DVTTextStorage")]) { 71 | return (DVTTextStorage *)textView.textStorage; 72 | } 73 | return nil; 74 | } 75 | 76 | + (NSArray *)getCurrentClassNameByCurrentSelectedRange 77 | { 78 | NSTextView *textView = [self currentSourceTextView]; 79 | NSArray* selectedRanges = [textView selectedRanges]; 80 | if (selectedRanges.count >= 1) { 81 | NSRange selectedRange = [[selectedRanges objectAtIndex:0] rangeValue]; 82 | NSString *text = textView.textStorage.string; 83 | NSRange lineRange = [text lineRangeForRange:selectedRange]; 84 | ; 85 | NSRegularExpression *regex = [NSRegularExpression 86 | regularExpressionWithPattern:@"(?<=@interface)\\s+(\\w+)\\s*\\(?(\\w*)\\)?" 87 | options:0 88 | error:NULL]; 89 | NSArray *results = [regex matchesInString:textView.textStorage.string options:0 range:NSMakeRange(0, lineRange.location)]; 90 | if (results.count > 0) { 91 | NSTextCheckingResult *textCheckingResult = results[results.count - 1]; 92 | NSRange classNameRange = textCheckingResult.range; 93 | if (classNameRange.location != NSNotFound) { 94 | NSMutableArray *array = [NSMutableArray array]; 95 | for (int i = 0; i < textCheckingResult.numberOfRanges; i++) { 96 | NSString *item = [text substringWithRange:[textCheckingResult rangeAtIndex:i]]; 97 | if (item.length > 0) { 98 | [array addObject:item]; 99 | // NSLog(@"%@", item); 100 | } 101 | } 102 | return array; 103 | } 104 | } 105 | } 106 | return nil; 107 | } 108 | 109 | + (NSScrollView *)currentScrollView { 110 | NSView *view = [self currentSourceTextView]; 111 | return [view enclosingScrollView]; 112 | } 113 | 114 | + (NSString *)getDotMFilePathOfCurrentEditFile { 115 | NSString *filePath = [[[self currentSourceCodeDocument] fileURL]path]; 116 | if ([filePath rangeOfString:@".h"].length > 0) { 117 | NSString *mFilePath = [filePath stringByReplacingOccurrencesOfString:@".h" withString:@".m"]; 118 | if ([[NSFileManager defaultManager] fileExistsAtPath:mFilePath]) { 119 | return mFilePath; 120 | } 121 | 122 | mFilePath = [filePath stringByReplacingOccurrencesOfString:@".h" withString:@".mm"]; 123 | if ([[NSFileManager defaultManager] fileExistsAtPath:mFilePath]) { 124 | return mFilePath; 125 | } 126 | 127 | } 128 | return filePath; 129 | } 130 | 131 | + (BOOL)openFile:(NSString *)filePath 132 | { 133 | NSWindowController *currentWindowController = [[NSApp mainWindow] windowController]; 134 | NSLog(@"currentWindowController %@",[currentWindowController description]); 135 | if ([currentWindowController isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) { 136 | NSLog(@"Open in current Xocde"); 137 | id appDelegate = (id)[NSApp delegate]; 138 | if ([appDelegate application:NSApp openFile:filePath]) { 139 | return YES; 140 | } 141 | } 142 | return NO; 143 | } 144 | 145 | + (NSRange)getInsertRangeWithClassImplementContentRange:(NSRange)range 146 | { 147 | if (range.location != NSNotFound) { 148 | return NSMakeRange(range.location+range.length, 1); 149 | } 150 | 151 | return NSMakeRange(NSNotFound, 0); 152 | } 153 | 154 | + (NSRange)getClassImplementContentRangeWithClassName:(NSString *)className mFileText:(NSString *)mFileText 155 | { 156 | 157 | NSString *regexPattern = [NSString stringWithFormat:@"@implementation\\s+%@.+?(?=\\s{0,1000}@end)", className]; 158 | 159 | NSLog(@"%@",regexPattern); 160 | 161 | NSRegularExpression *regex = [NSRegularExpression 162 | regularExpressionWithPattern:regexPattern 163 | options:NSRegularExpressionDotMatchesLineSeparators 164 | error:NULL]; 165 | 166 | NSTextCheckingResult *textCheckingResult = [regex firstMatchInString:mFileText 167 | options:0 168 | range:NSMakeRange(0, mFileText.length)]; 169 | 170 | // NSLog(@"%@", [mFileText substringWithRange:textCheckingResult.range]); 171 | if (textCheckingResult.range.location != NSNotFound) 172 | { 173 | return textCheckingResult.range; 174 | } 175 | else 176 | { 177 | return NSMakeRange(NSNotFound, 0); 178 | } 179 | 180 | } 181 | 182 | @end 183 | -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/DescriptionGenerator.m: -------------------------------------------------------------------------------- 1 | // 2 | // DescriptionGenerator.m 3 | // AutoGenerateDescriptionPluginProd 4 | // 5 | // Created by adam smith on 2/17/15. 6 | // Copyright (c) 2015 adam smith. All rights reserved. 7 | // 8 | 9 | #import "DescriptionGenerator.h" 10 | 11 | @interface DescriptionGenerator () 12 | 13 | @property (nonatomic) NSString *currentClass; 14 | 15 | @end 16 | 17 | @implementation DescriptionGenerator 18 | 19 | - (void)generateDescription { 20 | self.currentClass = [[DTXcodeUtils getCurrentClassNameByCurrentSelectedRange] lastObject]; 21 | NSString *selectedString = [self selectedString]; 22 | NSString *descriptionMethod = [self prepareDescriptionMethodWithSelectedString:selectedString]; 23 | NSLog(@"%@", descriptionMethod); 24 | [self writeMethodToFileWithDescriptionMethod:descriptionMethod]; 25 | } 26 | 27 | - (NSString *)selectedString { 28 | // This is a reference to the current source code editor. 29 | DVTSourceTextView *sourceTextView = [DTXcodeUtils currentSourceTextView]; 30 | // Get the range of the selected text within the source code editor. 31 | NSRange selectedTextRange = [sourceTextView selectedRange]; 32 | // Get the selected text using the range from above. 33 | NSString *selectedString = [sourceTextView.textStorage.string substringWithRange:selectedTextRange]; 34 | 35 | return selectedString; 36 | } 37 | 38 | - (NSString *)prepareDescriptionMethodWithSelectedString:(NSString *)selectedString { 39 | NSArray *properties = [selectedString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; 40 | NSMutableString *leftSideString = [NSMutableString stringWithFormat:@"@\"%@ description:%%@\\n ", self.currentClass]; 41 | NSMutableString *rightSideString = [NSMutableString stringWithString:@"[super description]"]; 42 | 43 | for (NSString *property in properties) { 44 | if (property.length != 0) { 45 | if ([property hasPrefix:@"//"] || [property hasPrefix:@"/*"] || [property hasPrefix:@" *"] || [property hasPrefix:@" */"]) { 46 | continue; 47 | } 48 | 49 | NSRange rangeOfComment = [property rangeOfString:@"//"]; 50 | NSMutableString *propertyStrippedOfTrailingCommentsAndSemiColon = nil; 51 | 52 | if (rangeOfComment.length > 0) { 53 | propertyStrippedOfTrailingCommentsAndSemiColon = [[property substringToIndex:rangeOfComment.location]copy]; 54 | propertyStrippedOfTrailingCommentsAndSemiColon = [[propertyStrippedOfTrailingCommentsAndSemiColon stringByReplacingOccurrencesOfString:@" " withString:@""]copy]; 55 | } else { 56 | propertyStrippedOfTrailingCommentsAndSemiColon = [property copy]; 57 | } 58 | 59 | propertyStrippedOfTrailingCommentsAndSemiColon = [[propertyStrippedOfTrailingCommentsAndSemiColon stringByReplacingOccurrencesOfString:@";" withString:@""] copy]; 60 | 61 | 62 | NSString *iVarWithOutPropertyPrefix = [RX(@"@property[ ]*\\(.+\\)[ ]*") replace:propertyStrippedOfTrailingCommentsAndSemiColon withBlock:^NSString *(NSString *match) { 63 | return @""; 64 | }]; 65 | 66 | NSString *dataTypeOfProperty = [[RX(@"^\\w+") matches:iVarWithOutPropertyPrefix]firstObject]; 67 | 68 | NSString *iVarRegex = nil; 69 | BOOL iVarIsPointer = [[RX(@"\\*") matches:iVarWithOutPropertyPrefix] count]; 70 | 71 | if (iVarIsPointer) { 72 | iVarRegex = @"\\*\\w+"; 73 | } else { 74 | iVarRegex = @"\\w+"; 75 | } 76 | 77 | NSString *iVarWithOutPropertyAndTypePrefix = [RX(@"^\\w+") replace:iVarWithOutPropertyPrefix withBlock:^NSString *(NSString *match) { 78 | return @""; 79 | }]; 80 | NSArray *iVarNameMatches = [RX(iVarRegex) matches:iVarWithOutPropertyAndTypePrefix]; 81 | 82 | void (^ handleVarName)(NSString *) = ^(NSString *iVarName) { 83 | if (iVarIsPointer) { 84 | iVarName = [iVarName substringFromIndex:1];//to remove prefix * 85 | } 86 | 87 | NSString *iVarNamePrependedWithSelf = [NSString stringWithFormat:@"self.%@", iVarName]; 88 | NSString *dataTypeMatch = dataTypeOfProperty; 89 | NSString *formattedRightSide = [self formatRightSideWithDataType:dataTypeMatch iVar:iVarNamePrependedWithSelf ]; 90 | NSString *token = [self matchTokenToDatatype:dataTypeMatch]; 91 | [leftSideString appendString:[NSString stringWithFormat:@"%@: %@\\n", iVarName, token]]; 92 | [rightSideString appendString:[NSString stringWithFormat:@", %@", formattedRightSide]]; 93 | }; 94 | 95 | if (iVarNameMatches.count) { 96 | [iVarNameMatches enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL *stop) { 97 | handleVarName(obj); 98 | }]; 99 | } 100 | } 101 | } 102 | 103 | [leftSideString appendString:@"\""]; 104 | NSString *descriptionMethod = [NSString stringWithFormat:@"\n- (NSString *)description\n{\n return [NSString stringWithFormat:%@,%@];\n}\n", leftSideString, rightSideString]; 105 | return descriptionMethod; 106 | } 107 | 108 | - (void)writeMethodToFileWithDescriptionMethod:(NSString *)descriptionMethod { 109 | [DTXcodeUtils openFile:[DTXcodeUtils getDotMFilePathOfCurrentEditFile]]; 110 | DVTSourceTextView *textView = [DTXcodeUtils currentSourceTextView]; 111 | NSString *textViewText = [textView string]; 112 | NSRange contentRange = [DTXcodeUtils getClassImplementContentRangeWithClassName:self.currentClass mFileText:textViewText]; 113 | NSRange insertRange = [DTXcodeUtils getInsertRangeWithClassImplementContentRange:contentRange]; 114 | [textView scrollRangeToVisible:insertRange]; 115 | NSString *newLinesRemoved = [[textViewText componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] componentsJoinedByString:@" "]; 116 | NSString *textViewTextSpacesRemoved = [newLinesRemoved stringByReplacingOccurrencesOfString:@" " withString:@""]; 117 | 118 | if ([textViewTextSpacesRemoved containsString:@")description"]) { 119 | NSAlert *alert = [[NSAlert alloc] init]; 120 | [alert setMessageText:@"Description method NOT generated because you already have one. Please delete existing method and try again."]; 121 | [alert runModal]; 122 | return; 123 | } else { 124 | [textView insertText:descriptionMethod replacementRange:insertRange]; 125 | } 126 | } 127 | 128 | - (NSString *)formatRightSideWithDataType:(NSString *)dataType iVar:(NSString *)iVar { 129 | NSDictionary *tableMethod = @{ 130 | @"NSRange": [NSString stringWithFormat:@"NSStringFromRange(%@)", iVar], 131 | @"CGPoint": [NSString stringWithFormat:@"NSStringFromCGPoint(%@)", iVar], 132 | @"CGVector": [NSString stringWithFormat:@"NSStringFromCGVector(%@)", iVar], 133 | @"CGSize": [NSString stringWithFormat:@"NSStringFromCGSize(%@)", iVar], 134 | @"CGRect": [NSString stringWithFormat:@"NSStringFromCGRect(%@)", iVar], 135 | @"CGAffineTransform": [NSString stringWithFormat:@"NSStringFromCGAffineTransform(%@)", iVar], 136 | @"UIEdgeInsets": [NSString stringWithFormat:@"NSStringFromUIEdgeInsets(%@)", iVar], 137 | @"UIOffset": [NSString stringWithFormat:@"NSStringFromUIOffset(%@)", iVar], 138 | @"SEL": [NSString stringWithFormat:@"NSStringFromSelector(%@)", iVar], 139 | @"Class": [NSString stringWithFormat:@"NSStringFromClass(%@)", iVar], 140 | @"Protocol": [NSString stringWithFormat:@"NSStringFromProtocol(%@)", iVar] 141 | }; 142 | NSString *formattedIVar = tableMethod[dataType]; 143 | 144 | return (formattedIVar ? formattedIVar : iVar); 145 | } 146 | 147 | - (NSString *)matchTokenToDatatype:(NSString *)dataType { 148 | NSDictionary *tableMethod = @{ 149 | @"int": @"%zd", 150 | @"unsignedint": @"%u", 151 | @"double": @"%f", 152 | @"float": @"%f", 153 | @"unsignedchar": @"%c", 154 | @"unichar": @"%C", 155 | @"NSInteger": @"%zd", 156 | @"NSUInteger": @"%zd", 157 | @"CGFloat": @"%f", 158 | @"CFIndex": @"%ld", 159 | @"pointer": @"%p", 160 | @"BOOL": @"%i" 161 | }; 162 | 163 | NSString *token = tableMethod[dataType]; 164 | 165 | return (token ? token : @"%@"); 166 | } 167 | 168 | @end -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd/RegExCategories.m: -------------------------------------------------------------------------------- 1 | // 2 | // RegExCategories.m 3 | // 4 | // https://github.com/bendytree/Objective-C-RegEx-Categories 5 | // 6 | // 7 | // The MIT License (MIT) 8 | // 9 | // Copyright (c) 2013 Josh Wright <@BendyTree> 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy 12 | // of this software and associated documentation files (the "Software"), to deal 13 | // in the Software without restriction, including without limitation the rights 14 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | // copies of the Software, and to permit persons to whom the Software is 16 | // furnished to do so, subject to the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be included in all 19 | // copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 27 | // SOFTWARE. 28 | // 29 | 30 | #import "RegExCategories.h" 31 | 32 | @implementation NSRegularExpression (ObjectiveCRegexCategories) 33 | 34 | - (id) initWithPattern:(NSString*)pattern 35 | { 36 | return [self initWithPattern:pattern options:0 error:nil]; 37 | } 38 | 39 | + (NSRegularExpression*) rx:(NSString*)pattern 40 | { 41 | return [[self alloc] initWithPattern:pattern]; 42 | } 43 | 44 | + (NSRegularExpression*) rx:(NSString*)pattern ignoreCase:(BOOL)ignoreCase 45 | { 46 | return [[self alloc] initWithPattern:pattern options:ignoreCase?NSRegularExpressionCaseInsensitive:0 error:nil]; 47 | } 48 | 49 | + (NSRegularExpression*) rx:(NSString*)pattern options:(NSRegularExpressionOptions)options 50 | { 51 | return [[self alloc] initWithPattern:pattern options:options error:nil]; 52 | } 53 | 54 | - (BOOL) isMatch:(NSString*)matchee 55 | { 56 | return [self numberOfMatchesInString:matchee options:0 range:NSMakeRange(0, matchee.length)] > 0; 57 | } 58 | 59 | - (int) indexOf:(NSString*)matchee 60 | { 61 | NSRange range = [self rangeOfFirstMatchInString:matchee options:0 range:NSMakeRange(0, matchee.length)]; 62 | return range.location == NSNotFound ? -1 : (int)range.location; 63 | } 64 | 65 | - (NSArray*) split:(NSString *)str 66 | { 67 | NSRange range = NSMakeRange(0, str.length); 68 | 69 | //get locations of matches 70 | NSMutableArray* matchingRanges = [NSMutableArray array]; 71 | NSArray* matches = [self matchesInString:str options:0 range:range]; 72 | for(NSTextCheckingResult* match in matches) { 73 | [matchingRanges addObject:[NSValue valueWithRange:match.range]]; 74 | } 75 | 76 | //invert ranges - get ranges of non-matched pieces 77 | NSMutableArray* pieceRanges = [NSMutableArray array]; 78 | 79 | //add first range 80 | [pieceRanges addObject:[NSValue valueWithRange:NSMakeRange(0, 81 | (matchingRanges.count == 0 ? str.length : [matchingRanges[0] rangeValue].location))]]; 82 | 83 | //add between splits ranges and last range 84 | for(int i=0; i=0; i--) { 120 | NSTextCheckingResult* match = matches[i]; 121 | NSString* matchStr = [string substringWithRange:match.range]; 122 | NSString* replacement = replacer(matchStr); 123 | [result replaceCharactersInRange:match.range withString:replacement]; 124 | } 125 | 126 | return result; 127 | } 128 | 129 | - (NSString*) replace:(NSString *)string withDetailsBlock:(NSString*(^)(RxMatch* match))replacer 130 | { 131 | //no replacer? just return 132 | if (!replacer) return string; 133 | 134 | //copy the string so we can replace subsections 135 | NSMutableString* replaced = [string mutableCopy]; 136 | 137 | //get matches 138 | NSArray* matches = [self matchesInString:string options:0 range:NSMakeRange(0, string.length)]; 139 | 140 | //replace each match (right to left so indexing doesn't get messed up) 141 | for (int i=(int)matches.count-1; i>=0; i--) { 142 | NSTextCheckingResult* result = matches[i]; 143 | RxMatch* match = [self resultToMatch:result original:string]; 144 | NSString* replacement = replacer(match); 145 | [replaced replaceCharactersInRange:result.range withString:replacement]; 146 | } 147 | 148 | return replaced; 149 | } 150 | 151 | - (NSArray*) matches:(NSString*)str 152 | { 153 | NSMutableArray* matches = [NSMutableArray array]; 154 | 155 | NSArray* results = [self matchesInString:str options:0 range:NSMakeRange(0, str.length)]; 156 | for (NSTextCheckingResult* result in results) { 157 | NSString* match = [str substringWithRange:result.range]; 158 | [matches addObject:match]; 159 | } 160 | 161 | return matches; 162 | } 163 | 164 | - (NSString*) firstMatch:(NSString*)str 165 | { 166 | NSTextCheckingResult* match = [self firstMatchInString:str options:0 range:NSMakeRange(0, str.length)]; 167 | 168 | if (!match) return nil; 169 | 170 | return [str substringWithRange:match.range]; 171 | } 172 | 173 | - (RxMatch*) resultToMatch:(NSTextCheckingResult*)result original:(NSString*)original 174 | { 175 | RxMatch* match = [[RxMatch alloc] init]; 176 | match.original = original; 177 | match.range = result.range; 178 | match.value = result.range.length ? [original substringWithRange:result.range] : nil; 179 | 180 | //groups 181 | NSMutableArray* groups = [NSMutableArray array]; 182 | match.groups = groups; 183 | for(int i=0; i 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy 12 | // of this software and associated documentation files (the "Software"), to deal 13 | // in the Software without restriction, including without limitation the rights 14 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | // copies of the Software, and to permit persons to whom the Software is 16 | // furnished to do so, subject to the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be included in all 19 | // copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 27 | // SOFTWARE. 28 | // 29 | 30 | #import 31 | 32 | 33 | /********************************************************/ 34 | /*********************** MACROS *************************/ 35 | /********************************************************/ 36 | 37 | /* 38 | * By default, Objective-C-Regex-Categories creates an alias for NSRegularExpression 39 | * called `Rx` and creates a macro `RX()` for quick regex creation. 40 | * 41 | * If you don't want these macros, add the following statement 42 | * before you include this library: 43 | * 44 | * #define DisableObjective-C-Regex-CategoriesMacros 45 | */ 46 | 47 | 48 | /** 49 | * Creates a macro (alias) for NSRegularExpression named `Rx`. 50 | * 51 | * ie. 52 | * NSRegularExpression* rx = [[Rx alloc] initWithPattern:@"\d+" options:0 error:nil]; 53 | */ 54 | 55 | #ifndef DisableObjectiveCRegexCategoriesMacros 56 | #define Rx NSRegularExpression 57 | #endif 58 | 59 | 60 | /** 61 | * Creates a macro (alias) for NSRegularExpression named `Rx`. 62 | * 63 | * ie. 64 | * NSRegularExpression* rx = [[Rx alloc] initWithPattern:@"\d+" options:0 error:nil]; 65 | */ 66 | 67 | #ifndef DisableObjectiveCRegexCategoriesMacros 68 | #define RX(pattern) [[NSRegularExpression alloc] initWithPattern:pattern] 69 | #endif 70 | 71 | 72 | 73 | /********************************************************/ 74 | /******************* MATCH OBJECTS **********************/ 75 | /********************************************************/ 76 | 77 | /** 78 | * RxMatch represents a single match. It contains the 79 | * matched value, range, sub groups, and the original 80 | * string. 81 | */ 82 | 83 | @interface RxMatch : NSObject 84 | @property (retain) NSString* value; /* The substring that matched the expression. */ 85 | @property (assign) NSRange range; /* The range of the original string that was matched. */ 86 | @property (retain) NSArray* groups; /* Each object is an RxMatchGroup. */ 87 | @property (retain) NSString* original; /* The full original string that was matched against. */ 88 | @end 89 | 90 | 91 | @interface RxMatchGroup : NSObject 92 | @property (retain) NSString* value; 93 | @property (assign) NSRange range; 94 | @end 95 | 96 | 97 | 98 | 99 | 100 | /** 101 | * Extend NSRegularExpression. 102 | */ 103 | 104 | @interface NSRegularExpression (ObjectiveCRegexCategories) 105 | 106 | 107 | /*******************************************************/ 108 | /******************* INITIALIZATION ********************/ 109 | /*******************************************************/ 110 | 111 | /** 112 | * Initialize an Rx object from a string. 113 | * 114 | * ie. 115 | * Rx* rx = [[Rx alloc] initWithString:@"\d+"]; 116 | */ 117 | 118 | - (NSRegularExpression*) initWithPattern:(NSString*)pattern; 119 | 120 | 121 | /** 122 | * Initialize an Rx object from a string. 123 | * 124 | * ie. 125 | * Rx* rx = [Rx rx:@"\d+"]; 126 | */ 127 | 128 | + (NSRegularExpression*) rx:(NSString*)pattern; 129 | 130 | 131 | /** 132 | * Initialize an Rx object from a string. By default, NSRegularExpression 133 | * is case sensitive, but this signature allows you to change that. 134 | * 135 | * ie. 136 | * Rx* rx = [Rx rx:@"\d+" ignoreCase:YES]; 137 | */ 138 | 139 | + (NSRegularExpression*) rx:(NSString*)pattern ignoreCase:(BOOL)ignoreCase; 140 | 141 | 142 | /** 143 | * Initialize an Rx object from a string and options. 144 | * 145 | * ie. 146 | * Rx* rx = [Rx rx:@"\d+" options:NSRegularExpressionCaseInsensitive]; 147 | */ 148 | 149 | + (NSRegularExpression*) rx:(NSString*)pattern options:(NSRegularExpressionOptions)options; 150 | 151 | 152 | /*******************************************************/ 153 | /********************** IS MATCH ***********************/ 154 | /*******************************************************/ 155 | 156 | /** 157 | * Returns true if the string matches the regex. May also 158 | * be called on NSString as [@"\d" isMatch:rx]. 159 | * 160 | * ie. 161 | * Rx* rx = RX(@"\d+"); 162 | * BOOL isMatch = [rx isMatch:@"Dog #1"]; // => true 163 | */ 164 | 165 | - (BOOL) isMatch:(NSString*)matchee; 166 | 167 | 168 | /** 169 | * Returns the index of the first match of the passed string. 170 | * 171 | * ie. 172 | * int i = [RX(@"\d+") indexOf:@"Buy 1 dog or buy 2?"]; // => 4 173 | */ 174 | 175 | - (int) indexOf:(NSString*)str; 176 | 177 | 178 | /** 179 | * Splits a string using the regex to identify delimeters. Returns 180 | * an NSArray of NSStrings. 181 | * 182 | * ie. 183 | * NSArray* pieces = [RX(@"[ ,]") split:@"A dog,cat"]; 184 | * => @[@"A", @"dog", @"cat"] 185 | */ 186 | 187 | - (NSArray*) split:(NSString*)str; 188 | 189 | 190 | /** 191 | * Replaces all occurances in a string with a replacement string. 192 | * 193 | * ie. 194 | * NSString* result = [RX(@"ruf+") replace:@"ruf ruff!" with:@"meow"]; 195 | * => @"meow meow!" 196 | */ 197 | 198 | - (NSString*) replace:(NSString*)string with:(NSString*)replacement; 199 | 200 | 201 | /** 202 | * Replaces all occurances of a regex using a block. The block receives the match 203 | * and should return the replacement. 204 | * 205 | * ie. 206 | * NSString* result = [RX(@"[A-Z]+") replace:@"i love COW" withBlock:^(NSString*){ return @"lamp"; }]; 207 | * => @"i love lamp" 208 | */ 209 | 210 | - (NSString*) replace:(NSString*)string withBlock:(NSString*(^)(NSString* match))replacer; 211 | 212 | 213 | /** 214 | * Replaces all occurances of a regex using a block. The block receives a RxMatch object 215 | * that contains all the details of the match and should return a string 216 | * which is what the match is replaced with. 217 | * 218 | * ie. 219 | * NSString* result = [RX(@"\\w+") replace:@"hi bud" withDetailsBlock:^(RxMatch* match){ return [NSString stringWithFormat:@"%i", match.value.length]; }]; 220 | * => @"2 3" 221 | */ 222 | 223 | - (NSString*) replace:(NSString *)string withDetailsBlock:(NSString*(^)(RxMatch* match))replacer; 224 | 225 | 226 | /** 227 | * Returns an array of matched root strings with no other match information. 228 | * 229 | * ie. 230 | * NSString* str = @"My email is me@example.com and yours is you@example.com"; 231 | * NSArray* matches = [RX(@"\\w+[@]\\w+[.](\\w+)") matches:str]; 232 | * => @[ @"me@example.com", @"you@example.com" ] 233 | */ 234 | 235 | - (NSArray*) matches:(NSString*)str; 236 | 237 | 238 | /** 239 | * Returns a string which is the first match of the NSRegularExpression. 240 | * 241 | * ie. 242 | * NSString* str = @"My email is me@example.com and yours is you@example.com"; 243 | * NSString* match = [RX(@"\\w+[@]\\w+[.](\\w+)") firstMatch:str]; 244 | * => @"me@example.com" 245 | */ 246 | 247 | - (NSString*) firstMatch:(NSString*)str; 248 | 249 | 250 | /** 251 | * Returns an NSArray of RxMatch* objects. Each match contains the matched 252 | * value, range, groups, etc. 253 | * 254 | * ie. 255 | * NSString* str = @"My email is me@example.com and yours is you@example.com"; 256 | * NSArray* matches = [str matchesWithDetails:RX(@"\\w+[@]\\w+[.](\\w+)")]; 257 | */ 258 | 259 | - (NSArray*) matchesWithDetails:(NSString*)str; 260 | 261 | 262 | /** 263 | * Returns the first match as an RxMatch* object. 264 | * 265 | * ie. 266 | * NSString* str = @"My email is me@example.com and yours is you@example.com"; 267 | * Rx* rx = RX(@"\\w+[@]\\w+[.](\\w+)"); 268 | * RxMatch* match = [rx firstMatchWithDetails:str]; 269 | */ 270 | 271 | - (RxMatch*) firstMatchWithDetails:(NSString*)str; 272 | 273 | @end 274 | 275 | 276 | 277 | /** 278 | * A category on NSString to make it easy to use 279 | * Rx in simple operations. 280 | */ 281 | 282 | @interface NSString (ObjectiveCRegexCategories) 283 | 284 | 285 | /** 286 | * Initialize an NSRegularExpression object from a string. 287 | * 288 | * ie. 289 | * NSRegularExpression* rx = [@"\d+" toRx]; 290 | */ 291 | 292 | - (NSRegularExpression*) toRx; 293 | 294 | 295 | /** 296 | * Initialize an NSRegularExpression object from a string with 297 | * a flag denoting case-sensitivity. By default, NSRegularExpression 298 | * is case sensitive. 299 | * 300 | * ie. 301 | * NSRegularExpression* rx = [@"\d+" toRxIgnoreCase:YES]; 302 | */ 303 | 304 | - (NSRegularExpression*) toRxIgnoreCase:(BOOL)ignoreCase; 305 | 306 | 307 | /** 308 | * Initialize an NSRegularExpression object from a string with options. 309 | * 310 | * ie. 311 | * NSRegularExpression* rx = [@"\d+" toRxWithOptions:NSRegularExpressionCaseInsensitive]; 312 | */ 313 | 314 | - (NSRegularExpression*) toRxWithOptions:(NSRegularExpressionOptions)options; 315 | 316 | 317 | /** 318 | * Returns true if the string matches the regex. May also 319 | * be called as on Rx as [rx isMatch:@"some string"]. 320 | * 321 | * ie. 322 | * BOOL isMatch = [@"Dog #1" isMatch:RX(@"\d+")]; // => true 323 | */ 324 | 325 | - (BOOL) isMatch:(NSRegularExpression*)rx; 326 | 327 | 328 | /** 329 | * Returns the index of the first match according to 330 | * the regex passed in. 331 | * 332 | * ie. 333 | * int i = [@"Buy 1 dog or buy 2?" indexOf:RX(@"\d+")]; // => 4 334 | */ 335 | 336 | - (int) indexOf:(NSRegularExpression*)rx; 337 | 338 | 339 | /** 340 | * Splits a string using the regex to identify delimeters. Returns 341 | * an NSArray of NSStrings. 342 | * 343 | * ie. 344 | * NSArray* pieces = [@"A dog,cat" split:RX(@"[ ,]")]; 345 | * => @[@"A", @"dog", @"cat"] 346 | */ 347 | 348 | - (NSArray*) split:(NSRegularExpression*)rx; 349 | 350 | 351 | /** 352 | * Replaces all occurances of a regex with a replacement string. 353 | * 354 | * ie. 355 | * NSString* result = [@"ruf ruff!" replace:RX(@"ruf+") with:@"meow"]; 356 | * => @"meow meow!" 357 | */ 358 | 359 | - (NSString*) replace:(NSRegularExpression*)rx with:(NSString*)replacement; 360 | 361 | 362 | /** 363 | * Replaces all occurances of a regex using a block. The block receives the match 364 | * and should return the replacement. 365 | * 366 | * ie. 367 | * NSString* result = [@"i love COW" replace:RX(@"[A-Z]+") withBlock:^(NSString*){ return @"lamp"; }]; 368 | * => @"i love lamp" 369 | */ 370 | 371 | - (NSString*) replace:(NSRegularExpression *)rx withBlock:(NSString*(^)(NSString* match))replacer; 372 | 373 | 374 | /** 375 | * Replaces all occurances of a regex using a block. The block receives an RxMatch 376 | * object which contains all of the details for each match and should return a string 377 | * which is what the match is replaced with. 378 | * 379 | * ie. 380 | * NSString* result = [@"hi bud" replace:RX(@"\\w+") withDetailsBlock:^(RxMatch* match){ return [NSString stringWithFormat:@"%i", match.value.length]; }]; 381 | * => @"2 3" 382 | */ 383 | 384 | - (NSString*) replace:(NSRegularExpression *)rx withDetailsBlock:(NSString*(^)(RxMatch* match))replacer; 385 | 386 | 387 | /** 388 | * Returns an array of matched root strings with no other match information. 389 | * 390 | * ie. 391 | * NSString* str = @"My email is me@example.com and yours is you@example.com"; 392 | * NSArray* matches = [str matches:RX(@"\\w+[@]\\w+[.](\\w+)")]; 393 | * => @[ @"me@example.com", @"you@example.com" ] 394 | */ 395 | 396 | - (NSArray*) matches:(NSRegularExpression*)rx; 397 | 398 | 399 | /** 400 | * Returns a string which is the first match of the NSRegularExpression. 401 | * 402 | * ie. 403 | * NSString* str = @"My email is me@example.com and yours is you@example.com"; 404 | * NSString* match = [str firstMatch:RX(@"\\w+[@]\\w+[.](\\w+)")]; 405 | * => @"me@example.com" 406 | */ 407 | 408 | - (NSString*) firstMatch:(NSRegularExpression*)rx; 409 | 410 | 411 | /** 412 | * Returns an NSArray of RxMatch* objects. Each match contains the matched 413 | * value, range, groups, etc. 414 | * 415 | * ie. 416 | * NSString* str = @"My email is me@example.com and yours is you@example.com"; 417 | * NSArray* matches = [str matchesWithDetails:RX(@"\\w+[@]\\w+[.](\\w+)")]; 418 | */ 419 | 420 | - (NSArray*) matchesWithDetails:(NSRegularExpression*)rx; 421 | 422 | 423 | /** 424 | * Returns an the first match as an RxMatch* object. 425 | * 426 | * ie. 427 | * NSString* str = @"My email is me@example.com and yours is you@example.com"; 428 | * RxMatch* match = [str firstMatchWithDetails:RX(@"\\w+[@]\\w+[.](\\w+)")]; 429 | */ 430 | 431 | - (RxMatch*) firstMatchWithDetails:(NSRegularExpression*)rx; 432 | 433 | @end 434 | 435 | -------------------------------------------------------------------------------- /AutoGenerateDescriptionPluginProd/AutoGenerateDescriptionPluginProd.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 66574EDE1A942DDA006703FD /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66574EDD1A942DDA006703FD /* AppKit.framework */; }; 11 | 66574EE01A942DDA006703FD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66574EDF1A942DDA006703FD /* Foundation.framework */; }; 12 | 66574EE51A942DDA006703FD /* AutoGenerateDescriptionPluginProd.xcscheme in Resources */ = {isa = PBXBuildFile; fileRef = 66574EE41A942DDA006703FD /* AutoGenerateDescriptionPluginProd.xcscheme */; }; 13 | 66574EE81A942DDA006703FD /* AutoGenerateDescriptionPluginProd.m in Sources */ = {isa = PBXBuildFile; fileRef = 66574EE71A942DDA006703FD /* AutoGenerateDescriptionPluginProd.m */; }; 14 | 66574EF21A9430C2006703FD /* DTXcodeUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 66574EF11A9430C2006703FD /* DTXcodeUtils.m */; }; 15 | 66574EF51A9430D3006703FD /* RegExCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 66574EF41A9430D3006703FD /* RegExCategories.m */; }; 16 | 66574EF81A9430EB006703FD /* DescriptionGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 66574EF71A9430EB006703FD /* DescriptionGenerator.m */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 66574EDA1A942DDA006703FD /* AutoGenerateDescriptionPluginProd.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AutoGenerateDescriptionPluginProd.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 66574EDD1A942DDA006703FD /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 22 | 66574EDF1A942DDA006703FD /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 23 | 66574EE31A942DDA006703FD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 24 | 66574EE41A942DDA006703FD /* AutoGenerateDescriptionPluginProd.xcscheme */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = AutoGenerateDescriptionPluginProd.xcscheme; path = AutoGenerateDescriptionPluginProd.xcodeproj/xcshareddata/xcschemes/AutoGenerateDescriptionPluginProd.xcscheme; sourceTree = SOURCE_ROOT; }; 25 | 66574EE61A942DDA006703FD /* AutoGenerateDescriptionPluginProd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AutoGenerateDescriptionPluginProd.h; sourceTree = ""; }; 26 | 66574EE71A942DDA006703FD /* AutoGenerateDescriptionPluginProd.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AutoGenerateDescriptionPluginProd.m; sourceTree = ""; }; 27 | 66574EEF1A9430C2006703FD /* DTXcodeHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTXcodeHeaders.h; sourceTree = ""; }; 28 | 66574EF01A9430C2006703FD /* DTXcodeUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTXcodeUtils.h; sourceTree = ""; }; 29 | 66574EF11A9430C2006703FD /* DTXcodeUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTXcodeUtils.m; sourceTree = ""; }; 30 | 66574EF31A9430D3006703FD /* RegExCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegExCategories.h; sourceTree = ""; }; 31 | 66574EF41A9430D3006703FD /* RegExCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RegExCategories.m; sourceTree = ""; }; 32 | 66574EF61A9430EB006703FD /* DescriptionGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DescriptionGenerator.h; sourceTree = ""; }; 33 | 66574EF71A9430EB006703FD /* DescriptionGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DescriptionGenerator.m; sourceTree = ""; }; 34 | 66574EFB1A9471BC006703FD /* AutoGenerateDescriptionPluginProd.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoGenerateDescriptionPluginProd.pch; sourceTree = ""; }; 35 | /* End PBXFileReference section */ 36 | 37 | /* Begin PBXFrameworksBuildPhase section */ 38 | 66574ED81A942DDA006703FD /* Frameworks */ = { 39 | isa = PBXFrameworksBuildPhase; 40 | buildActionMask = 2147483647; 41 | files = ( 42 | 66574EDE1A942DDA006703FD /* AppKit.framework in Frameworks */, 43 | 66574EE01A942DDA006703FD /* Foundation.framework in Frameworks */, 44 | ); 45 | runOnlyForDeploymentPostprocessing = 0; 46 | }; 47 | /* End PBXFrameworksBuildPhase section */ 48 | 49 | /* Begin PBXGroup section */ 50 | 66574ED11A942DDA006703FD = { 51 | isa = PBXGroup; 52 | children = ( 53 | 66574EE11A942DDA006703FD /* AutoGenerateDescriptionPluginProd */, 54 | 66574EDC1A942DDA006703FD /* Frameworks */, 55 | 66574EDB1A942DDA006703FD /* Products */, 56 | ); 57 | sourceTree = ""; 58 | }; 59 | 66574EDB1A942DDA006703FD /* Products */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 66574EDA1A942DDA006703FD /* AutoGenerateDescriptionPluginProd.xcplugin */, 63 | ); 64 | name = Products; 65 | sourceTree = ""; 66 | }; 67 | 66574EDC1A942DDA006703FD /* Frameworks */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | 66574EDD1A942DDA006703FD /* AppKit.framework */, 71 | 66574EDF1A942DDA006703FD /* Foundation.framework */, 72 | ); 73 | name = Frameworks; 74 | sourceTree = ""; 75 | }; 76 | 66574EE11A942DDA006703FD /* AutoGenerateDescriptionPluginProd */ = { 77 | isa = PBXGroup; 78 | children = ( 79 | 66574EEE1A9430A2006703FD /* OpenSource */, 80 | 66574EE61A942DDA006703FD /* AutoGenerateDescriptionPluginProd.h */, 81 | 66574EE71A942DDA006703FD /* AutoGenerateDescriptionPluginProd.m */, 82 | 66574EF61A9430EB006703FD /* DescriptionGenerator.h */, 83 | 66574EF71A9430EB006703FD /* DescriptionGenerator.m */, 84 | 66574EFB1A9471BC006703FD /* AutoGenerateDescriptionPluginProd.pch */, 85 | 66574EE21A942DDA006703FD /* Supporting Files */, 86 | ); 87 | path = AutoGenerateDescriptionPluginProd; 88 | sourceTree = ""; 89 | }; 90 | 66574EE21A942DDA006703FD /* Supporting Files */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 66574EE31A942DDA006703FD /* Info.plist */, 94 | 66574EE41A942DDA006703FD /* AutoGenerateDescriptionPluginProd.xcscheme */, 95 | ); 96 | name = "Supporting Files"; 97 | sourceTree = ""; 98 | }; 99 | 66574EEE1A9430A2006703FD /* OpenSource */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 66574EF31A9430D3006703FD /* RegExCategories.h */, 103 | 66574EF41A9430D3006703FD /* RegExCategories.m */, 104 | 66574EEF1A9430C2006703FD /* DTXcodeHeaders.h */, 105 | 66574EF01A9430C2006703FD /* DTXcodeUtils.h */, 106 | 66574EF11A9430C2006703FD /* DTXcodeUtils.m */, 107 | ); 108 | name = OpenSource; 109 | sourceTree = ""; 110 | }; 111 | /* End PBXGroup section */ 112 | 113 | /* Begin PBXNativeTarget section */ 114 | 66574ED91A942DDA006703FD /* AutoGenerateDescriptionPluginProd */ = { 115 | isa = PBXNativeTarget; 116 | buildConfigurationList = 66574EEB1A942DDA006703FD /* Build configuration list for PBXNativeTarget "AutoGenerateDescriptionPluginProd" */; 117 | buildPhases = ( 118 | 66574ED61A942DDA006703FD /* Sources */, 119 | 66574ED71A942DDA006703FD /* Resources */, 120 | 66574ED81A942DDA006703FD /* Frameworks */, 121 | ); 122 | buildRules = ( 123 | ); 124 | dependencies = ( 125 | ); 126 | name = AutoGenerateDescriptionPluginProd; 127 | productName = AutoGenerateDescriptionPluginProd; 128 | productReference = 66574EDA1A942DDA006703FD /* AutoGenerateDescriptionPluginProd.xcplugin */; 129 | productType = "com.apple.product-type.bundle"; 130 | }; 131 | /* End PBXNativeTarget section */ 132 | 133 | /* Begin PBXProject section */ 134 | 66574ED21A942DDA006703FD /* Project object */ = { 135 | isa = PBXProject; 136 | attributes = { 137 | LastUpgradeCheck = 0610; 138 | ORGANIZATIONNAME = "adam smith"; 139 | TargetAttributes = { 140 | 66574ED91A942DDA006703FD = { 141 | CreatedOnToolsVersion = 6.1.1; 142 | }; 143 | }; 144 | }; 145 | buildConfigurationList = 66574ED51A942DDA006703FD /* Build configuration list for PBXProject "AutoGenerateDescriptionPluginProd" */; 146 | compatibilityVersion = "Xcode 3.2"; 147 | developmentRegion = English; 148 | hasScannedForEncodings = 0; 149 | knownRegions = ( 150 | en, 151 | ); 152 | mainGroup = 66574ED11A942DDA006703FD; 153 | productRefGroup = 66574EDB1A942DDA006703FD /* Products */; 154 | projectDirPath = ""; 155 | projectRoot = ""; 156 | targets = ( 157 | 66574ED91A942DDA006703FD /* AutoGenerateDescriptionPluginProd */, 158 | ); 159 | }; 160 | /* End PBXProject section */ 161 | 162 | /* Begin PBXResourcesBuildPhase section */ 163 | 66574ED71A942DDA006703FD /* Resources */ = { 164 | isa = PBXResourcesBuildPhase; 165 | buildActionMask = 2147483647; 166 | files = ( 167 | 66574EE51A942DDA006703FD /* AutoGenerateDescriptionPluginProd.xcscheme in Resources */, 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | }; 171 | /* End PBXResourcesBuildPhase section */ 172 | 173 | /* Begin PBXSourcesBuildPhase section */ 174 | 66574ED61A942DDA006703FD /* Sources */ = { 175 | isa = PBXSourcesBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | 66574EF81A9430EB006703FD /* DescriptionGenerator.m in Sources */, 179 | 66574EE81A942DDA006703FD /* AutoGenerateDescriptionPluginProd.m in Sources */, 180 | 66574EF51A9430D3006703FD /* RegExCategories.m in Sources */, 181 | 66574EF21A9430C2006703FD /* DTXcodeUtils.m in Sources */, 182 | ); 183 | runOnlyForDeploymentPostprocessing = 0; 184 | }; 185 | /* End PBXSourcesBuildPhase section */ 186 | 187 | /* Begin XCBuildConfiguration section */ 188 | 66574EE91A942DDA006703FD /* Debug */ = { 189 | isa = XCBuildConfiguration; 190 | buildSettings = { 191 | ALWAYS_SEARCH_USER_PATHS = NO; 192 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 193 | CLANG_CXX_LIBRARY = "libc++"; 194 | CLANG_ENABLE_MODULES = YES; 195 | CLANG_ENABLE_OBJC_ARC = YES; 196 | CLANG_WARN_BOOL_CONVERSION = YES; 197 | CLANG_WARN_CONSTANT_CONVERSION = YES; 198 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 199 | CLANG_WARN_EMPTY_BODY = YES; 200 | CLANG_WARN_ENUM_CONVERSION = YES; 201 | CLANG_WARN_INT_CONVERSION = YES; 202 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 203 | CLANG_WARN_UNREACHABLE_CODE = YES; 204 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 205 | COPY_PHASE_STRIP = NO; 206 | ENABLE_STRICT_OBJC_MSGSEND = YES; 207 | GCC_C_LANGUAGE_STANDARD = gnu99; 208 | GCC_DYNAMIC_NO_PIC = NO; 209 | GCC_OPTIMIZATION_LEVEL = 0; 210 | GCC_PREPROCESSOR_DEFINITIONS = ( 211 | "DEBUG=1", 212 | "$(inherited)", 213 | ); 214 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 215 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 216 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 217 | GCC_WARN_UNDECLARED_SELECTOR = YES; 218 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 219 | GCC_WARN_UNUSED_FUNCTION = YES; 220 | GCC_WARN_UNUSED_VARIABLE = YES; 221 | MTL_ENABLE_DEBUG_INFO = YES; 222 | ONLY_ACTIVE_ARCH = YES; 223 | }; 224 | name = Debug; 225 | }; 226 | 66574EEA1A942DDA006703FD /* Release */ = { 227 | isa = XCBuildConfiguration; 228 | buildSettings = { 229 | ALWAYS_SEARCH_USER_PATHS = NO; 230 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 231 | CLANG_CXX_LIBRARY = "libc++"; 232 | CLANG_ENABLE_MODULES = YES; 233 | CLANG_ENABLE_OBJC_ARC = YES; 234 | CLANG_WARN_BOOL_CONVERSION = YES; 235 | CLANG_WARN_CONSTANT_CONVERSION = YES; 236 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 237 | CLANG_WARN_EMPTY_BODY = YES; 238 | CLANG_WARN_ENUM_CONVERSION = YES; 239 | CLANG_WARN_INT_CONVERSION = YES; 240 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 241 | CLANG_WARN_UNREACHABLE_CODE = YES; 242 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 243 | COPY_PHASE_STRIP = YES; 244 | ENABLE_NS_ASSERTIONS = NO; 245 | ENABLE_STRICT_OBJC_MSGSEND = YES; 246 | GCC_C_LANGUAGE_STANDARD = gnu99; 247 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 248 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 249 | GCC_WARN_UNDECLARED_SELECTOR = YES; 250 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 251 | GCC_WARN_UNUSED_FUNCTION = YES; 252 | GCC_WARN_UNUSED_VARIABLE = YES; 253 | MTL_ENABLE_DEBUG_INFO = NO; 254 | }; 255 | name = Release; 256 | }; 257 | 66574EEC1A942DDA006703FD /* Debug */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | COMBINE_HIDPI_IMAGES = YES; 261 | DEPLOYMENT_LOCATION = YES; 262 | DSTROOT = "$(HOME)"; 263 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 264 | GCC_PREFIX_HEADER = ""; 265 | INFOPLIST_FILE = AutoGenerateDescriptionPluginProd/Info.plist; 266 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 267 | MACOSX_DEPLOYMENT_TARGET = 10.10; 268 | PRODUCT_NAME = "$(TARGET_NAME)"; 269 | WRAPPER_EXTENSION = xcplugin; 270 | }; 271 | name = Debug; 272 | }; 273 | 66574EED1A942DDA006703FD /* Release */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | COMBINE_HIDPI_IMAGES = YES; 277 | DEPLOYMENT_LOCATION = YES; 278 | DSTROOT = "$(HOME)"; 279 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 280 | INFOPLIST_FILE = AutoGenerateDescriptionPluginProd/Info.plist; 281 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 282 | MACOSX_DEPLOYMENT_TARGET = 10.10; 283 | PRODUCT_NAME = "$(TARGET_NAME)"; 284 | WRAPPER_EXTENSION = xcplugin; 285 | }; 286 | name = Release; 287 | }; 288 | /* End XCBuildConfiguration section */ 289 | 290 | /* Begin XCConfigurationList section */ 291 | 66574ED51A942DDA006703FD /* Build configuration list for PBXProject "AutoGenerateDescriptionPluginProd" */ = { 292 | isa = XCConfigurationList; 293 | buildConfigurations = ( 294 | 66574EE91A942DDA006703FD /* Debug */, 295 | 66574EEA1A942DDA006703FD /* Release */, 296 | ); 297 | defaultConfigurationIsVisible = 0; 298 | defaultConfigurationName = Release; 299 | }; 300 | 66574EEB1A942DDA006703FD /* Build configuration list for PBXNativeTarget "AutoGenerateDescriptionPluginProd" */ = { 301 | isa = XCConfigurationList; 302 | buildConfigurations = ( 303 | 66574EEC1A942DDA006703FD /* Debug */, 304 | 66574EED1A942DDA006703FD /* Release */, 305 | ); 306 | defaultConfigurationIsVisible = 0; 307 | defaultConfigurationName = Release; 308 | }; 309 | /* End XCConfigurationList section */ 310 | }; 311 | rootObject = 66574ED21A942DDA006703FD /* Project object */; 312 | } 313 | --------------------------------------------------------------------------------