├── .gitignore ├── .travis.yml ├── AMMethod2Implement.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── AMMethod2Implement.xcscheme ├── AMMethod2Implement ├── AMConstString.h ├── AMConstString.m ├── AMIDEHelper.h ├── AMIDEHelper.m ├── AMMenuGenerator.h ├── AMMenuGenerator.m ├── AMMethod2Implement-Info.plist ├── AMMethod2Implement-Prefix.pch ├── AMMethod2Implement.h ├── AMMethod2Implement.m ├── AMSettingWindowController.h ├── AMSettingWindowController.m ├── AMSettingWindowController.xib ├── AMXcodeHelper.h ├── AMXcodeHelper.m ├── MenuItemData.plist ├── NSStringAdditions.h ├── NSStringAdditions.m ├── RegexData.plist └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── README.md └── Screenshots ├── AMMethodImplementInAlcatraz.png ├── banner.png ├── declare_method.gif ├── implement_selector.gif └── usageScreenshot.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # CocoaPods 2 | # 3 | # We recommend against adding the Pods directory to your .gitignore. However 4 | # you should judge for yourself, the pros and cons are mentioned at: 5 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control? 6 | # 7 | # Pods/ 8 | 9 | ### Xcode ### 10 | build/ 11 | *.pbxuser 12 | !default.pbxuser 13 | *.mode1v3 14 | !default.mode1v3 15 | *.mode2v3 16 | !default.mode2v3 17 | *.perspectivev3 18 | !default.perspectivev3 19 | xcuserdata 20 | *.xccheckout 21 | profile 22 | *.moved-aside 23 | DerivedData 24 | *.hmap 25 | *.ipa 26 | 27 | ### OSX ### 28 | .DS_Store 29 | *.swp 30 | *~.nib 31 | 32 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | xcode_project: AMMethod2Implement.xcodeproj 3 | xcode_scheme: AMMethod2Implement 4 | -------------------------------------------------------------------------------- /AMMethod2Implement.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | D301792F1ACBA5150053550D /* AMSettingWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = D3E07CB51AC951E1007F8F79 /* AMSettingWindowController.m */; }; 11 | D3BC0AC01ACB8EAF0028F983 /* RegexData.plist in Resources */ = {isa = PBXBuildFile; fileRef = D3BC0ABF1ACB8EAF0028F983 /* RegexData.plist */; }; 12 | D3BC0AC21ACB8EBD0028F983 /* MenuItemData.plist in Resources */ = {isa = PBXBuildFile; fileRef = D3BC0AC11ACB8EBD0028F983 /* MenuItemData.plist */; }; 13 | D3E07CBA1AC95228007F8F79 /* AMSettingWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D3E07CB91AC95228007F8F79 /* AMSettingWindowController.xib */; }; 14 | D3FC8EB61AF1FDF00024BCF1 /* AMConstString.m in Sources */ = {isa = PBXBuildFile; fileRef = D311670D1ACB92250039DB28 /* AMConstString.m */; }; 15 | D3FC8EB71AF1FE0C0024BCF1 /* AMMenuGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = D37A47C31ACB974700E1491F /* AMMenuGenerator.m */; }; 16 | FDBF0B9C18FD6C5C00C5759C /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDBF0B9B18FD6C5C00C5759C /* AppKit.framework */; }; 17 | FDBF0B9E18FD6C5C00C5759C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDBF0B9D18FD6C5C00C5759C /* Foundation.framework */; }; 18 | FDBF0BA418FD6C5C00C5759C /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = FDBF0BA218FD6C5C00C5759C /* InfoPlist.strings */; }; 19 | FDBF0BA718FD6C5C00C5759C /* AMMethod2Implement.m in Sources */ = {isa = PBXBuildFile; fileRef = FDBF0BA618FD6C5C00C5759C /* AMMethod2Implement.m */; }; 20 | FDBF0BB018FD70A300C5759C /* AMXcodeHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = FDBF0BAF18FD70A300C5759C /* AMXcodeHelper.m */; }; 21 | FDBF0BB318FD71DB00C5759C /* AMIDEHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = FDBF0BB218FD71DB00C5759C /* AMIDEHelper.m */; }; 22 | FDBF0BB618FD7D9600C5759C /* NSStringAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = FDBF0BB518FD7D9600C5759C /* NSStringAdditions.m */; }; 23 | FDBF0BB918FD845800C5759C /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = FDBF0BB718FD845800C5759C /* LICENSE */; }; 24 | FDBF0BBA18FD845800C5759C /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = FDBF0BB818FD845800C5759C /* README.md */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | D311670C1ACB92250039DB28 /* AMConstString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMConstString.h; sourceTree = ""; }; 29 | D311670D1ACB92250039DB28 /* AMConstString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMConstString.m; sourceTree = ""; }; 30 | D37A47C21ACB974700E1491F /* AMMenuGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMMenuGenerator.h; sourceTree = ""; }; 31 | D37A47C31ACB974700E1491F /* AMMenuGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMMenuGenerator.m; sourceTree = ""; }; 32 | D3BC0ABF1ACB8EAF0028F983 /* RegexData.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = RegexData.plist; sourceTree = ""; }; 33 | D3BC0AC11ACB8EBD0028F983 /* MenuItemData.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = MenuItemData.plist; sourceTree = ""; }; 34 | D3E07CB41AC951E1007F8F79 /* AMSettingWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMSettingWindowController.h; sourceTree = ""; }; 35 | D3E07CB51AC951E1007F8F79 /* AMSettingWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMSettingWindowController.m; sourceTree = ""; }; 36 | D3E07CB91AC95228007F8F79 /* AMSettingWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMSettingWindowController.xib; sourceTree = ""; }; 37 | FDBF0B9818FD6C5C00C5759C /* AMMethod2Implement.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = AMMethod2Implement.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | FDBF0B9B18FD6C5C00C5759C /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 39 | FDBF0B9D18FD6C5C00C5759C /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 40 | FDBF0BA118FD6C5C00C5759C /* AMMethod2Implement-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AMMethod2Implement-Info.plist"; sourceTree = ""; }; 41 | FDBF0BA318FD6C5C00C5759C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 42 | FDBF0BA518FD6C5C00C5759C /* AMMethod2Implement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AMMethod2Implement.h; sourceTree = ""; }; 43 | FDBF0BA618FD6C5C00C5759C /* AMMethod2Implement.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AMMethod2Implement.m; sourceTree = ""; }; 44 | FDBF0BA818FD6C5C00C5759C /* AMMethod2Implement-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AMMethod2Implement-Prefix.pch"; sourceTree = ""; }; 45 | FDBF0BAE18FD70A300C5759C /* AMXcodeHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMXcodeHelper.h; sourceTree = ""; }; 46 | FDBF0BAF18FD70A300C5759C /* AMXcodeHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMXcodeHelper.m; sourceTree = ""; }; 47 | FDBF0BB118FD71DB00C5759C /* AMIDEHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AMIDEHelper.h; sourceTree = ""; }; 48 | FDBF0BB218FD71DB00C5759C /* AMIDEHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AMIDEHelper.m; sourceTree = ""; }; 49 | FDBF0BB418FD7D9600C5759C /* NSStringAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSStringAdditions.h; sourceTree = ""; }; 50 | FDBF0BB518FD7D9600C5759C /* NSStringAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSStringAdditions.m; sourceTree = ""; }; 51 | FDBF0BB718FD845800C5759C /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 52 | FDBF0BB818FD845800C5759C /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | FDBF0B9518FD6C5C00C5759C /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | FDBF0B9C18FD6C5C00C5759C /* AppKit.framework in Frameworks */, 61 | FDBF0B9E18FD6C5C00C5759C /* Foundation.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | FDBF0B8F18FD6C5B00C5759C = { 69 | isa = PBXGroup; 70 | children = ( 71 | FDBF0BB718FD845800C5759C /* LICENSE */, 72 | FDBF0BB818FD845800C5759C /* README.md */, 73 | FDBF0B9F18FD6C5C00C5759C /* AMMethod2Implement */, 74 | FDBF0B9A18FD6C5C00C5759C /* Frameworks */, 75 | FDBF0B9918FD6C5C00C5759C /* Products */, 76 | ); 77 | sourceTree = ""; 78 | }; 79 | FDBF0B9918FD6C5C00C5759C /* Products */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | FDBF0B9818FD6C5C00C5759C /* AMMethod2Implement.xcplugin */, 83 | ); 84 | name = Products; 85 | sourceTree = ""; 86 | }; 87 | FDBF0B9A18FD6C5C00C5759C /* Frameworks */ = { 88 | isa = PBXGroup; 89 | children = ( 90 | FDBF0B9B18FD6C5C00C5759C /* AppKit.framework */, 91 | FDBF0B9D18FD6C5C00C5759C /* Foundation.framework */, 92 | ); 93 | name = Frameworks; 94 | sourceTree = ""; 95 | }; 96 | FDBF0B9F18FD6C5C00C5759C /* AMMethod2Implement */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | FDBF0BA518FD6C5C00C5759C /* AMMethod2Implement.h */, 100 | FDBF0BA618FD6C5C00C5759C /* AMMethod2Implement.m */, 101 | FDBF0BAE18FD70A300C5759C /* AMXcodeHelper.h */, 102 | FDBF0BAF18FD70A300C5759C /* AMXcodeHelper.m */, 103 | FDBF0BB118FD71DB00C5759C /* AMIDEHelper.h */, 104 | FDBF0BB218FD71DB00C5759C /* AMIDEHelper.m */, 105 | D3E07CB41AC951E1007F8F79 /* AMSettingWindowController.h */, 106 | D3E07CB51AC951E1007F8F79 /* AMSettingWindowController.m */, 107 | D3E07CB91AC95228007F8F79 /* AMSettingWindowController.xib */, 108 | FDBF0BB418FD7D9600C5759C /* NSStringAdditions.h */, 109 | FDBF0BB518FD7D9600C5759C /* NSStringAdditions.m */, 110 | D311670C1ACB92250039DB28 /* AMConstString.h */, 111 | D311670D1ACB92250039DB28 /* AMConstString.m */, 112 | D37A47C21ACB974700E1491F /* AMMenuGenerator.h */, 113 | D37A47C31ACB974700E1491F /* AMMenuGenerator.m */, 114 | D3BC0ABF1ACB8EAF0028F983 /* RegexData.plist */, 115 | D3BC0AC11ACB8EBD0028F983 /* MenuItemData.plist */, 116 | FDBF0BA018FD6C5C00C5759C /* Supporting Files */, 117 | ); 118 | path = AMMethod2Implement; 119 | sourceTree = ""; 120 | }; 121 | FDBF0BA018FD6C5C00C5759C /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | FDBF0BA118FD6C5C00C5759C /* AMMethod2Implement-Info.plist */, 125 | FDBF0BA218FD6C5C00C5759C /* InfoPlist.strings */, 126 | FDBF0BA818FD6C5C00C5759C /* AMMethod2Implement-Prefix.pch */, 127 | ); 128 | name = "Supporting Files"; 129 | sourceTree = ""; 130 | }; 131 | /* End PBXGroup section */ 132 | 133 | /* Begin PBXNativeTarget section */ 134 | FDBF0B9718FD6C5C00C5759C /* AMMethod2Implement */ = { 135 | isa = PBXNativeTarget; 136 | buildConfigurationList = FDBF0BAB18FD6C5C00C5759C /* Build configuration list for PBXNativeTarget "AMMethod2Implement" */; 137 | buildPhases = ( 138 | FDBF0B9418FD6C5C00C5759C /* Sources */, 139 | FDBF0B9518FD6C5C00C5759C /* Frameworks */, 140 | FDBF0B9618FD6C5C00C5759C /* Resources */, 141 | ); 142 | buildRules = ( 143 | ); 144 | dependencies = ( 145 | ); 146 | name = AMMethod2Implement; 147 | productName = AMMethod2Implement; 148 | productReference = FDBF0B9818FD6C5C00C5759C /* AMMethod2Implement.xcplugin */; 149 | productType = "com.apple.product-type.bundle"; 150 | }; 151 | /* End PBXNativeTarget section */ 152 | 153 | /* Begin PBXProject section */ 154 | FDBF0B9018FD6C5B00C5759C /* Project object */ = { 155 | isa = PBXProject; 156 | attributes = { 157 | CLASSPREFIX = ""; 158 | LastUpgradeCheck = 0510; 159 | ORGANIZATIONNAME = Tendencystudio; 160 | }; 161 | buildConfigurationList = FDBF0B9318FD6C5B00C5759C /* Build configuration list for PBXProject "AMMethod2Implement" */; 162 | compatibilityVersion = "Xcode 3.2"; 163 | developmentRegion = English; 164 | hasScannedForEncodings = 0; 165 | knownRegions = ( 166 | en, 167 | ); 168 | mainGroup = FDBF0B8F18FD6C5B00C5759C; 169 | productRefGroup = FDBF0B9918FD6C5C00C5759C /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | FDBF0B9718FD6C5C00C5759C /* AMMethod2Implement */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | FDBF0B9618FD6C5C00C5759C /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | D3E07CBA1AC95228007F8F79 /* AMSettingWindowController.xib in Resources */, 184 | FDBF0BBA18FD845800C5759C /* README.md in Resources */, 185 | D3BC0AC21ACB8EBD0028F983 /* MenuItemData.plist in Resources */, 186 | FDBF0BB918FD845800C5759C /* LICENSE in Resources */, 187 | D3BC0AC01ACB8EAF0028F983 /* RegexData.plist in Resources */, 188 | FDBF0BA418FD6C5C00C5759C /* InfoPlist.strings in Resources */, 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | }; 192 | /* End PBXResourcesBuildPhase section */ 193 | 194 | /* Begin PBXSourcesBuildPhase section */ 195 | FDBF0B9418FD6C5C00C5759C /* Sources */ = { 196 | isa = PBXSourcesBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | D3FC8EB61AF1FDF00024BCF1 /* AMConstString.m in Sources */, 200 | FDBF0BA718FD6C5C00C5759C /* AMMethod2Implement.m in Sources */, 201 | FDBF0BB618FD7D9600C5759C /* NSStringAdditions.m in Sources */, 202 | FDBF0BB018FD70A300C5759C /* AMXcodeHelper.m in Sources */, 203 | D301792F1ACBA5150053550D /* AMSettingWindowController.m in Sources */, 204 | D3FC8EB71AF1FE0C0024BCF1 /* AMMenuGenerator.m in Sources */, 205 | FDBF0BB318FD71DB00C5759C /* AMIDEHelper.m in Sources */, 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | }; 209 | /* End PBXSourcesBuildPhase section */ 210 | 211 | /* Begin PBXVariantGroup section */ 212 | FDBF0BA218FD6C5C00C5759C /* InfoPlist.strings */ = { 213 | isa = PBXVariantGroup; 214 | children = ( 215 | FDBF0BA318FD6C5C00C5759C /* en */, 216 | ); 217 | name = InfoPlist.strings; 218 | sourceTree = ""; 219 | }; 220 | /* End PBXVariantGroup section */ 221 | 222 | /* Begin XCBuildConfiguration section */ 223 | FDBF0BA918FD6C5C00C5759C /* Debug */ = { 224 | isa = XCBuildConfiguration; 225 | buildSettings = { 226 | ALWAYS_SEARCH_USER_PATHS = NO; 227 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 228 | CLANG_CXX_LIBRARY = "libc++"; 229 | CLANG_ENABLE_MODULES = YES; 230 | CLANG_ENABLE_OBJC_ARC = YES; 231 | CLANG_WARN_BOOL_CONVERSION = YES; 232 | CLANG_WARN_CONSTANT_CONVERSION = YES; 233 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 234 | CLANG_WARN_EMPTY_BODY = YES; 235 | CLANG_WARN_ENUM_CONVERSION = YES; 236 | CLANG_WARN_INT_CONVERSION = YES; 237 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 238 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 239 | COPY_PHASE_STRIP = NO; 240 | GCC_C_LANGUAGE_STANDARD = gnu99; 241 | GCC_DYNAMIC_NO_PIC = NO; 242 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 243 | GCC_OPTIMIZATION_LEVEL = 0; 244 | GCC_PREPROCESSOR_DEFINITIONS = ( 245 | "DEBUG=1", 246 | "$(inherited)", 247 | ); 248 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 249 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 250 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 251 | GCC_WARN_UNDECLARED_SELECTOR = YES; 252 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 253 | GCC_WARN_UNUSED_FUNCTION = YES; 254 | GCC_WARN_UNUSED_VARIABLE = YES; 255 | MACOSX_DEPLOYMENT_TARGET = 10.9; 256 | ONLY_ACTIVE_ARCH = YES; 257 | SDKROOT = macosx; 258 | }; 259 | name = Debug; 260 | }; 261 | FDBF0BAA18FD6C5C00C5759C /* Release */ = { 262 | isa = XCBuildConfiguration; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 266 | CLANG_CXX_LIBRARY = "libc++"; 267 | CLANG_ENABLE_MODULES = YES; 268 | CLANG_ENABLE_OBJC_ARC = YES; 269 | CLANG_WARN_BOOL_CONVERSION = YES; 270 | CLANG_WARN_CONSTANT_CONVERSION = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INT_CONVERSION = YES; 275 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 276 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 277 | COPY_PHASE_STRIP = YES; 278 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 279 | ENABLE_NS_ASSERTIONS = NO; 280 | GCC_C_LANGUAGE_STANDARD = gnu99; 281 | GCC_ENABLE_OBJC_EXCEPTIONS = YES; 282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 284 | GCC_WARN_UNDECLARED_SELECTOR = YES; 285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 286 | GCC_WARN_UNUSED_FUNCTION = YES; 287 | GCC_WARN_UNUSED_VARIABLE = YES; 288 | MACOSX_DEPLOYMENT_TARGET = 10.9; 289 | SDKROOT = macosx; 290 | }; 291 | name = Release; 292 | }; 293 | FDBF0BAC18FD6C5C00C5759C /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | COMBINE_HIDPI_IMAGES = YES; 297 | DEPLOYMENT_LOCATION = YES; 298 | DSTROOT = "$(HOME)"; 299 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 300 | GCC_PREFIX_HEADER = "AMMethod2Implement/AMMethod2Implement-Prefix.pch"; 301 | INFOPLIST_FILE = "AMMethod2Implement/AMMethod2Implement-Info.plist"; 302 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 303 | PRODUCT_NAME = "$(TARGET_NAME)"; 304 | WRAPPER_EXTENSION = xcplugin; 305 | }; 306 | name = Debug; 307 | }; 308 | FDBF0BAD18FD6C5C00C5759C /* Release */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | COMBINE_HIDPI_IMAGES = YES; 312 | DEPLOYMENT_LOCATION = YES; 313 | DSTROOT = "$(HOME)"; 314 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 315 | GCC_PREFIX_HEADER = "AMMethod2Implement/AMMethod2Implement-Prefix.pch"; 316 | INFOPLIST_FILE = "AMMethod2Implement/AMMethod2Implement-Info.plist"; 317 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 318 | PRODUCT_NAME = "$(TARGET_NAME)"; 319 | WRAPPER_EXTENSION = xcplugin; 320 | }; 321 | name = Release; 322 | }; 323 | /* End XCBuildConfiguration section */ 324 | 325 | /* Begin XCConfigurationList section */ 326 | FDBF0B9318FD6C5B00C5759C /* Build configuration list for PBXProject "AMMethod2Implement" */ = { 327 | isa = XCConfigurationList; 328 | buildConfigurations = ( 329 | FDBF0BA918FD6C5C00C5759C /* Debug */, 330 | FDBF0BAA18FD6C5C00C5759C /* Release */, 331 | ); 332 | defaultConfigurationIsVisible = 0; 333 | defaultConfigurationName = Release; 334 | }; 335 | FDBF0BAB18FD6C5C00C5759C /* Build configuration list for PBXNativeTarget "AMMethod2Implement" */ = { 336 | isa = XCConfigurationList; 337 | buildConfigurations = ( 338 | FDBF0BAC18FD6C5C00C5759C /* Debug */, 339 | FDBF0BAD18FD6C5C00C5759C /* Release */, 340 | ); 341 | defaultConfigurationIsVisible = 0; 342 | defaultConfigurationName = Release; 343 | }; 344 | /* End XCConfigurationList section */ 345 | }; 346 | rootObject = FDBF0B9018FD6C5B00C5759C /* Project object */; 347 | } 348 | -------------------------------------------------------------------------------- /AMMethod2Implement.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AMMethod2Implement.xcodeproj/xcshareddata/xcschemes/AMMethod2Implement.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 46 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMConstString.h: -------------------------------------------------------------------------------- 1 | // 2 | // AMConstString.h 3 | // AMMethod2Implement 4 | // 5 | // Created by JohnnyLiu on 15/4/1. 6 | // Copyright (c) 2015年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | extern NSString * const kDeclareMap; 13 | extern NSString * const kImplementMap; 14 | extern NSString * const kImplementContent; 15 | 16 | extern NSString * const kSelectTextType; 17 | extern NSString * const kSelectTextFirstSelectMethod; 18 | 19 | extern NSString * const kMenuRootMenuTitle; 20 | extern NSString * const kMenuPluginTitle; 21 | extern NSString * const kMenuSubMenuItems; 22 | extern NSString * const kMenuTitle; 23 | extern NSString * const kMenuSelector; 24 | extern NSString * const kMenuShortcut; 25 | extern NSString * const kMenuKeyMask; 26 | extern NSString * const kMenuKeyEquivalent; 27 | 28 | extern NSString * const kMenuActionTitle; -------------------------------------------------------------------------------- /AMMethod2Implement/AMConstString.m: -------------------------------------------------------------------------------- 1 | // 2 | // AMConstString.m 3 | // AMMethod2Implement 4 | // 5 | // Created by JohnnyLiu on 15/4/1. 6 | // Copyright (c) 2015年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import "AMConstString.h" 10 | 11 | 12 | NSString * const kDeclareMap = @"declareMap"; 13 | NSString * const kImplementMap = @"implementMap"; 14 | NSString * const kImplementContent = @"implementContent"; 15 | 16 | NSString * const kSelectTextType = @"type"; 17 | NSString * const kSelectTextFirstSelectMethod = @"firstSelectMethod"; 18 | 19 | NSString * const kMenuRootMenuTitle = @"rootMenuTitle"; 20 | NSString * const kMenuPluginTitle = @"pluginTitle"; 21 | NSString * const kMenuSubMenuItems = @"subMenuItems"; 22 | NSString * const kMenuTitle = @"title"; 23 | NSString * const kMenuSelector = @"selector"; 24 | NSString * const kMenuShortcut = @"shortcut"; 25 | NSString * const kMenuKeyMask = @"keyMask"; 26 | NSString * const kMenuKeyEquivalent = @"keyEquivalent"; 27 | 28 | NSString * const kMenuActionTitle = @"Implement Mehod"; -------------------------------------------------------------------------------- /AMMethod2Implement/AMIDEHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // AMIDEHelper.h 3 | // AMMethod2Implement 4 | // 5 | // Created by Long on 14-4-15. 6 | // Copyright (c) 2014年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef enum { 12 | AMIDEFileTypeMFile = 0, 13 | AMIDEFileTypeHFile 14 | }AMIDEFileType; 15 | 16 | typedef enum { 17 | AMImplementTypeMethod = 0, 18 | AMImplementTypeConstString, 19 | AMImplementTypeSelector, 20 | AMImplementTypeInvocation, 21 | AMImplementTypeGetter 22 | }AMImplementType; 23 | 24 | @interface AMIDEHelper : NSObject 25 | 26 | /** 27 | * Open file in Xcode editor. 28 | * 29 | * @param filePath file path. 30 | * 31 | * @return return YES if open file success. 32 | */ 33 | + (BOOL)openFile:(NSString *)filePath; 34 | 35 | /** 36 | * Get current edit file path. 37 | * 38 | * @return current edit file path 39 | */ 40 | + (NSString *)getCurrentEditFilePath; 41 | 42 | /** 43 | * Get .m file of current edit file. 44 | * 45 | * @return .m file path. 46 | */ 47 | + (NSString *)getMFilePathOfCurrentEditFile; 48 | 49 | /** 50 | * Get current class name by "Current Edit File Path" 51 | * 52 | * @return class name. 53 | */ 54 | + (NSString *)getCurrentClassName; 55 | 56 | /** 57 | * Check current opened file is .h file. 58 | * 59 | * @return return YES if current fils is .h file. 60 | */ 61 | + (BOOL)isHeaderFile; 62 | 63 | /** 64 | * Get .h file of current edit file. 65 | * 66 | * @return .h file path. 67 | */ 68 | + (NSString *)getHFilePathOfCurrentEditFile; 69 | 70 | /** 71 | * Highlight text and scroll to visible in current edit file. 72 | * 73 | * @param target text. 74 | */ 75 | + (void)selectText:(NSString *)text; 76 | 77 | /** 78 | * Search regex string and scroll to visible in current edit file. 79 | * 80 | * @param regex regex string. 81 | * @param text highlight text. 82 | */ 83 | + (void)selectTextWithRegex:(NSString *)regex highlightText:(NSString *)text; 84 | 85 | /** 86 | * Replace text in current editor. 87 | * 88 | * @param text text to be replace. 89 | * @param newText new text. 90 | */ 91 | + (void)replaceText:(NSString *)text withNewText:(NSString *)newText; 92 | 93 | /** 94 | * Get current selected range string. 95 | * 96 | * @return selected range string. 97 | */ 98 | + (NSString *)getCurrentSelectMethod; 99 | 100 | /** 101 | * Get all class name by @interface or @implementation of .h file or .m file of the current edit file. 102 | * 103 | * @param fileType AMIDEFileTypeMFile or AMIDEFileTypeHFile 104 | * 105 | * @return class name. 106 | */ 107 | + (NSArray *)getCurrentClassNameByCurrentSelectedRangeWithFileType:(AMIDEFileType)fileType; 108 | 109 | /** 110 | * Get target insert position for code generation. 111 | * 112 | * @param range content range: contentRange = [AMIDEHelper getClassImplementContentRangeWithClassNameItemList:currentClassName fileText:textView.textStorage.string fileType:AMIDEFileTypeMFile]; 113 | * 114 | * @return target insert range. 115 | */ 116 | + (NSRange)getInsertRangeWithClassImplementContentRange:(NSRange)range; 117 | 118 | /** 119 | * Get class @interface or @implementation code range(before @end) in .h or .m file. 120 | * 121 | * @param classNameItemList all class name by: NSArray *currentClassName = [AMIDEHelper getCurrentClassNameByCurrentSelectedRangeWithFileType:AMIDEFileTypeHFile]; 122 | * @param fileText target string for match, should be .m (fileType should be AMIDEFileTypeMFile) or .h (fileType should be AMIDEFileTypeHFile) file content string. 123 | * @param fileType AMIDEFileTypeMFile or AMIDEFileTypeHFile 124 | * 125 | * @return range from @interface/@implementation to @end, not include @end. 126 | */ 127 | + (NSRange)getClassImplementContentRangeWithClassNameItemList:(NSArray *)classNameItemList 128 | fileText:(NSString *)fileText 129 | fileType:(AMIDEFileType)fileType; 130 | 131 | @end 132 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMIDEHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // AMIDEHelper.m 3 | // AMMethod2Implement 4 | // 5 | // Created by Long on 14-4-15. 6 | // Copyright (c) 2014年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import "AMIDEHelper.h" 10 | 11 | @implementation AMIDEHelper 12 | 13 | 14 | + (BOOL)openFile:(NSString *)filePath 15 | { 16 | NSWindowController *currentWindowController = [[NSApp mainWindow] windowController]; 17 | NSLog(@"currentWindowController %@",[currentWindowController description]); 18 | if ([currentWindowController isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) { 19 | NSLog(@"Open in current Xocde"); 20 | id appDelegate = (id)[NSApp delegate]; 21 | if ([appDelegate application:NSApp openFile:filePath]) { 22 | return YES; 23 | } 24 | } 25 | return NO; 26 | } 27 | 28 | + (NSString *)getCurrentEditFilePath 29 | { 30 | IDESourceCodeDocument *currentSourceCodeDocument = [AMXcodeHelper currentSourceCodeDocument]; 31 | NSString *filePath = [[currentSourceCodeDocument fileURL] path]; 32 | return filePath; 33 | } 34 | 35 | + (BOOL)isHeaderFile 36 | { 37 | NSString *filePath = [AMIDEHelper getCurrentEditFilePath]; 38 | if ([filePath rangeOfString:@".h"].length > 0) { 39 | return YES; 40 | } 41 | return NO; 42 | } 43 | 44 | + (NSString *)getHFilePathOfCurrentEditFile 45 | { 46 | NSString *filePath = [AMIDEHelper getCurrentEditFilePath]; 47 | filePath = [filePath stringByDeletingPathExtension]; 48 | filePath = [filePath stringByAppendingPathExtension:@"h"]; 49 | return filePath; 50 | } 51 | 52 | + (NSString *)getMFilePathOfCurrentEditFile 53 | { 54 | NSString *filePath = [AMIDEHelper getCurrentEditFilePath]; 55 | if ([filePath rangeOfString:@".h"].length > 0) { 56 | NSString *mFilePath = [filePath stringByReplacingOccurrencesOfString:@".h" withString:@".m"]; 57 | if ([[NSFileManager defaultManager] fileExistsAtPath:mFilePath]) { 58 | return mFilePath; 59 | } 60 | 61 | mFilePath = [filePath stringByReplacingOccurrencesOfString:@".h" withString:@".mm"]; 62 | if ([[NSFileManager defaultManager] fileExistsAtPath:mFilePath]) { 63 | return mFilePath; 64 | } 65 | 66 | } 67 | return filePath; 68 | } 69 | 70 | + (NSString *)getCurrentClassName 71 | { 72 | NSString *fileName = [[AMIDEHelper getCurrentEditFilePath] lastPathComponent]; 73 | return [fileName stringByDeletingPathExtension]; 74 | } 75 | 76 | + (void)selectText:(NSString *)text 77 | { 78 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 79 | NSRange textRange = [textView.textStorage.string rangeOfString:text options:NSCaseInsensitiveSearch]; 80 | if (textRange.location != NSNotFound) 81 | { 82 | [textView setSelectedRange:textRange]; 83 | [textView scrollRangeToVisible:textRange]; 84 | } 85 | } 86 | 87 | + (void)selectTextWithRegex:(NSString *)regex highlightText:(NSString *)text 88 | { 89 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 90 | NSRegularExpression *regularExpression = [NSRegularExpression 91 | regularExpressionWithPattern:regex 92 | options:NSRegularExpressionAnchorsMatchLines 93 | error:NULL]; 94 | 95 | NSRange range = [regularExpression rangeOfFirstMatchInString:textView.textStorage.string 96 | options:0 97 | range:NSMakeRange(0, [textView.textStorage.string length])]; 98 | if (range.location == NSNotFound) { 99 | return; 100 | } 101 | 102 | NSString *string = [textView.textStorage.string substringWithRange:range]; 103 | NSLog(@"selectTextWithRegex: %@", string); 104 | NSRange textRange = [string rangeOfString:text options:NSCaseInsensitiveSearch]; 105 | if (textRange.location != NSNotFound) { 106 | range = NSMakeRange(range.location+textRange.location, textRange.length); 107 | } 108 | [textView setSelectedRange:range]; 109 | [textView scrollRangeToVisible:range]; 110 | } 111 | 112 | + (void)replaceText:(NSString *)text withNewText:(NSString *)newText 113 | { 114 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 115 | NSRange textRange = [textView.textStorage.string rangeOfString:text options:NSCaseInsensitiveSearch]; 116 | [textView scrollRangeToVisible:textRange]; 117 | [textView insertText:newText replacementRange:textRange]; 118 | } 119 | 120 | + (NSString *)getCurrentSelectMethod 121 | { 122 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 123 | NSArray* selectedRanges = [textView selectedRanges]; 124 | if (selectedRanges.count >= 1) { 125 | NSRange selectedRange = [[selectedRanges objectAtIndex:0] rangeValue]; 126 | NSString *text = textView.textStorage.string; 127 | NSRange lineRange = [text lineRangeForRange:selectedRange]; 128 | NSString *line = [text substringWithRange:lineRange]; 129 | return line; 130 | } 131 | return nil; 132 | } 133 | 134 | + (NSArray *)getCurrentClassNameByCurrentSelectedRangeWithFileType:(AMIDEFileType)fileType 135 | { 136 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 137 | NSArray* selectedRanges = [textView selectedRanges]; 138 | if (selectedRanges.count >= 1) { 139 | NSRange selectedRange = [[selectedRanges objectAtIndex:0] rangeValue]; 140 | NSString *text = textView.textStorage.string; 141 | NSRange lineRange = [text lineRangeForRange:selectedRange]; 142 | NSString *regexString = nil; 143 | if (fileType == AMIDEFileTypeHFile) { 144 | regexString = @"(?<=@interface)\\s+(\\w+)\\s*\\(?(\\w*)\\)?"; 145 | }else if (fileType == AMIDEFileTypeMFile) { 146 | regexString = @"(?<=@implementation)\\s+(\\w+)\\s*\\(?(\\w*)\\)?"; 147 | } 148 | NSRegularExpression *regex = [NSRegularExpression 149 | regularExpressionWithPattern:regexString 150 | options:0 151 | error:NULL]; 152 | NSArray *results = [regex matchesInString:textView.textStorage.string options:0 range:NSMakeRange(0, lineRange.location)]; 153 | if (results.count > 0) { 154 | NSTextCheckingResult *textCheckingResult = results[results.count - 1]; 155 | NSRange classNameRange = textCheckingResult.range; 156 | if (classNameRange.location != NSNotFound) { 157 | NSMutableArray *array = [NSMutableArray array]; 158 | for (int i = 0; i < textCheckingResult.numberOfRanges; i++) { 159 | NSString *item = [text substringWithRange:[textCheckingResult rangeAtIndex:i]]; 160 | if (item.length > 0) { 161 | [array addObject:item]; 162 | NSLog(@"%@", item); 163 | } 164 | } 165 | return array; 166 | } 167 | } 168 | } 169 | return nil; 170 | } 171 | 172 | + (NSRange)getClassImplementContentRangeWithClassNameItemList:(NSArray *)classNameItemList fileText:(NSString *)fileText fileType:(AMIDEFileType)fileType 173 | { 174 | if (classNameItemList.count > 1) { 175 | NSString *normalImplementationFormatString = @"@implementation\\s+%@.+?(?=\\s{0,3000}@end)"; 176 | if (fileType == AMIDEFileTypeHFile) { 177 | normalImplementationFormatString = @"@interface\\s+%@.+?(?=\\s{0,3000}@end)"; 178 | } 179 | 180 | NSString *regexPattern = [NSString stringWithFormat:normalImplementationFormatString, classNameItemList[1]]; 181 | if (classNameItemList.count == 3) { 182 | NSString *categoryImplementationFormatString = @"@implementation\\s+%@\\s+\\(%@\\).+?(?=\\s{0,3000}@end)"; 183 | if (fileType == AMIDEFileTypeHFile) { 184 | categoryImplementationFormatString = @"@interface\\s+%@\\s+\\(%@\\).+?(?=\\s{0,3000}@end)"; 185 | } 186 | regexPattern = [NSString stringWithFormat:categoryImplementationFormatString, classNameItemList[1], classNameItemList[2]]; 187 | } 188 | NSLog(@"#%@",regexPattern); 189 | 190 | NSRegularExpression *regex = [NSRegularExpression 191 | regularExpressionWithPattern:regexPattern 192 | options:NSRegularExpressionDotMatchesLineSeparators 193 | error:NULL]; 194 | 195 | NSTextCheckingResult *textCheckingResult = [regex firstMatchInString:fileText 196 | options:0 197 | range:NSMakeRange(0, fileText.length)]; 198 | 199 | // NSLog(@"#%@", [fileText substringWithRange:textCheckingResult.range]); 200 | if (textCheckingResult.range.location != NSNotFound) { 201 | return textCheckingResult.range; 202 | } 203 | 204 | } 205 | return NSMakeRange(NSNotFound, 0); 206 | } 207 | 208 | + (NSRange)getInsertRangeWithClassImplementContentRange:(NSRange)range 209 | { 210 | if (range.location != NSNotFound) { 211 | return NSMakeRange(range.location+range.length, 1); 212 | } 213 | 214 | return NSMakeRange(NSNotFound, 0); 215 | } 216 | 217 | @end 218 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMMenuGenerator.h: -------------------------------------------------------------------------------- 1 | // 2 | // AMMenuGenerator.h 3 | // AMMethod2Implement 4 | // 5 | // Created by JohnnyLiu on 15/4/1. 6 | // Copyright (c) 2015年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AMMenuGenerator : NSObject 12 | 13 | + (void)generateMenuItems:(NSBundle *)bundle version:(NSString *)version target:(id)target; 14 | + (NSUInteger)getKeyEquivalentModifierMaskWithKey:(NSString *)key; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMMenuGenerator.m: -------------------------------------------------------------------------------- 1 | // 2 | // AMMenuGenerator.m 3 | // AMMethod2Implement 4 | // 5 | // Created by JohnnyLiu on 15/4/1. 6 | // Copyright (c) 2015年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import "AMMenuGenerator.h" 10 | 11 | @implementation AMMenuGenerator 12 | 13 | + (void)generateMenuItems:(NSBundle *)bundle version:(NSString *)version target:(id)target 14 | { 15 | NSString *dataPath = [bundle pathForResource:@"MenuItemData" ofType:@"plist"]; 16 | NSDictionary *menuData = [NSDictionary dictionaryWithContentsOfFile:dataPath]; 17 | NSMenuItem *menuItem = [[NSApp mainMenu] itemWithTitle:menuData[kMenuRootMenuTitle]]; 18 | 19 | if (menuItem) { 20 | 21 | [[menuItem submenu] addItem:[NSMenuItem separatorItem]]; 22 | NSString *title = menuData[kMenuPluginTitle]; 23 | NSMenuItem *actionMenuItem = [[NSMenuItem alloc] initWithTitle:title action:nil keyEquivalent:@""]; 24 | [[menuItem submenu] addItem:actionMenuItem]; 25 | NSMenu* submenu = [[NSMenu alloc] init]; 26 | [actionMenuItem setSubmenu:submenu]; 27 | for (NSDictionary *item in menuData[kMenuSubMenuItems]) { 28 | NSString *subMenuTitle = item[kMenuTitle]; 29 | if ([subMenuTitle rangeOfString:@"%@"].length > 0) { 30 | subMenuTitle = [NSString stringWithFormat:subMenuTitle, version]; 31 | } 32 | 33 | NSString *selectorString = item[kMenuSelector]; 34 | SEL selector = nil; 35 | if (selectorString != nil && selectorString.length > 0) { 36 | selector = NSSelectorFromString(selectorString); 37 | } 38 | NSString *keyEquivalent = @""; 39 | if (item[kMenuShortcut][kMenuKeyEquivalent] != nil) { 40 | keyEquivalent = item[kMenuShortcut][kMenuKeyEquivalent]; 41 | } 42 | 43 | NSArray *maskArray = item[kMenuShortcut][kMenuKeyMask]; 44 | NSDictionary *userMenu = [[NSUserDefaults standardUserDefaults] objectForKey:kMenuActionTitle]; 45 | if (userMenu != nil) { 46 | keyEquivalent = userMenu[kMenuKeyEquivalent]; 47 | maskArray = userMenu[kMenuShortcut]; 48 | } 49 | 50 | NSMenuItem *subMenuItem = [[NSMenuItem alloc] initWithTitle:subMenuTitle action:selector keyEquivalent:keyEquivalent]; 51 | 52 | if (maskArray.count == 1) { 53 | subMenuItem.keyEquivalentModifierMask = [AMMenuGenerator getKeyEquivalentModifierMaskWithKey:maskArray[0]]; 54 | }else if(maskArray.count == 2) { 55 | subMenuItem.keyEquivalentModifierMask = [AMMenuGenerator getKeyEquivalentModifierMaskWithKey:maskArray[0]] | 56 | [AMMenuGenerator getKeyEquivalentModifierMaskWithKey:maskArray[1]]; 57 | } 58 | subMenuItem.target = target; 59 | [submenu addItem:subMenuItem]; 60 | } 61 | 62 | } 63 | } 64 | 65 | + (NSUInteger)getKeyEquivalentModifierMaskWithKey:(NSString *)key 66 | { 67 | NSDictionary *keyMaskMap = @{@"ctrl":@(NSControlKeyMask), 68 | @"shift":@(NSShiftKeyMask), 69 | @"cmd":@(NSCommandKeyMask), 70 | @"alt":@(NSAlternateKeyMask)}; 71 | return [keyMaskMap[key] integerValue]; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMMethod2Implement-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.tendencystudio.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleShortVersionString 20 | 3.4 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 3.4 25 | DVTPlugInCompatibilityUUIDs 26 | 27 | 640F884E-CE55-4B40-87C0-8869546CAB7A 28 | C4A681B0-4A26-480E-93EC-1218098B9AA0 29 | 37B30044-3B14-46BA-ABAA-F01000C27B63 30 | A2E4D43F-41F4-4FB9-BB94-7177011C9AED 31 | A16FF353-8441-459E-A50C-B071F53F51B7 32 | 992275C1-432A-4CF7-B659-D84ED6D42D3F 33 | 9F75337B-21B4-4ADC-B558-F9CADF7073A7 34 | E969541F-E6F9-4D25-8158-72DC3545A6C6 35 | 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 36 | 0420B86A-AA43-4792-9ED0-6FE0F2B16A13 37 | 7265231C-39B4-402C-89E1-16167C4CC990 38 | F41BD31E-2683-44B8-AE7F-5F09E919790E 39 | ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C 40 | 41 | NSPrincipalClass 42 | AMAMMethod2Implement 43 | XC4Compatible 44 | 45 | XC5Compatible 46 | 47 | XCGCReady 48 | 49 | XCPluginHasUI 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMMethod2Implement-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | #import "AMXcodeHelper.h" 10 | #import "NSStringAdditions.h" 11 | #import "AMConstString.h" 12 | #endif 13 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMMethod2Implement.h: -------------------------------------------------------------------------------- 1 | // 2 | // AMMethod2Implement.h 3 | // AMMethod2Implement 4 | // 5 | // Created by Mellong on 14-4-15. 6 | // Copyright (c) 2014年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AMMethod2Implement : NSObject 12 | 13 | 14 | @end -------------------------------------------------------------------------------- /AMMethod2Implement/AMMethod2Implement.m: -------------------------------------------------------------------------------- 1 | // 2 | // AMAMMethod2Implement.m 3 | // AMAMMethod2Implement 4 | // 5 | // Created by Mellong on 14-4-15. 6 | // Copyright (c) 2014年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import "AMMethod2Implement.h" 10 | #import "AMIDEHelper.h" 11 | #import "AMSettingWindowController.h" 12 | #import "AMMenuGenerator.h" 13 | 14 | static AMMethod2Implement *sharedPlugin; 15 | 16 | @interface AMMethod2Implement() 17 | { 18 | NSArray *_implementMap; 19 | NSArray *_declareMap; 20 | NSArray *_implementContent; 21 | } 22 | 23 | @property (nonatomic, strong) NSBundle *bundle; 24 | @property (nonatomic, strong) AMSettingWindowController * settingWindowController; 25 | 26 | @end 27 | 28 | @implementation AMMethod2Implement 29 | 30 | 31 | + (void)pluginDidLoad:(NSBundle *)plugin 32 | { 33 | static id sharedPlugin = nil; 34 | static dispatch_once_t onceToken; 35 | NSString *currentApplicationName = [[NSBundle mainBundle] infoDictionary][@"CFBundleName"]; 36 | if ([currentApplicationName isEqual:@"Xcode"]) { 37 | dispatch_once(&onceToken, ^{ 38 | sharedPlugin = [[self alloc] initWithBundle:plugin]; 39 | }); 40 | } 41 | } 42 | 43 | - (id)initWithBundle:(NSBundle *)plugin 44 | { 45 | if (self = [super init]) { 46 | // reference to plugin's bundle, for resource acccess 47 | self.bundle = plugin; 48 | [[NSNotificationCenter defaultCenter] addObserver:self 49 | selector:@selector(applicationDidFinishLaunching:) 50 | name:NSApplicationDidFinishLaunchingNotification 51 | object:nil]; 52 | 53 | 54 | } 55 | return self; 56 | } 57 | 58 | 59 | - (void)applicationDidFinishLaunching:(NSNotification *)notification 60 | { 61 | [self initData]; 62 | [self createMenuItem]; 63 | } 64 | 65 | - (void)createMenuItem 66 | { 67 | [AMMenuGenerator generateMenuItems:self.bundle version:[self getBundleVersion] target:self]; 68 | } 69 | 70 | - (NSString *)getBundleVersion 71 | { 72 | NSString *bundleVersion = [[self.bundle infoDictionary] objectForKey:@"CFBundleShortVersionString"]; 73 | return bundleVersion; 74 | } 75 | 76 | 77 | 78 | - (void)initData 79 | { 80 | NSDictionary *data = [NSDictionary dictionaryWithContentsOfFile:[self.bundle pathForResource:@"RegexData" ofType:@"plist"]]; 81 | _declareMap = data[kDeclareMap]; 82 | _implementMap = data[kImplementMap]; 83 | NSArray *implementContents = data[kImplementContent]; 84 | _implementContent = [self escapeCharacterWithArray:implementContents]; 85 | } 86 | 87 | - (NSArray *)escapeCharacterWithArray:(NSArray *)array 88 | { 89 | NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:array.count]; 90 | for (id item in array) { 91 | if ([item isKindOfClass:[NSArray class]]) { 92 | [mutableArray addObject:[self escapeCharacterWithArray:item]]; 93 | }else if ([item isKindOfClass:[NSString class]]){ 94 | NSString *stringItem = (NSString *)item; 95 | stringItem = [stringItem stringByReplacingOccurrencesOfString:@"\\n" withString:@"\n"]; 96 | stringItem = [stringItem stringByReplacingOccurrencesOfString:@"\\t" withString:@"\t"]; 97 | [mutableArray addObject:stringItem]; 98 | } 99 | } 100 | return mutableArray; 101 | } 102 | 103 | - (void)implementMethod:(NSString *)selectString 104 | { 105 | NSArray *currentClassName = [AMIDEHelper getCurrentClassNameByCurrentSelectedRangeWithFileType:AMIDEFileTypeHFile]; 106 | NSArray *methodList = [selectString componentsSeparatedByString:@";"]; 107 | NSMutableString *stringResult = [NSMutableString string]; 108 | NSDictionary *selectTextDictionary = nil; 109 | BOOL shouldSelect = YES; 110 | BOOL hasOpenMFile = NO; 111 | for (NSString *methodItem in methodList) { 112 | if (methodItem.length == 0) { 113 | continue; 114 | } 115 | 116 | 117 | 118 | NSInteger matchIndex = [methodItem getMatchIndexWithRegexList:_declareMap]; 119 | 120 | if (matchIndex != -1) 121 | { 122 | NSString *mfilePath = [AMIDEHelper getMFilePathOfCurrentEditFile]; 123 | if (hasOpenMFile == NO) { 124 | 125 | [AMIDEHelper openFile:mfilePath]; 126 | hasOpenMFile = YES; 127 | } 128 | 129 | 130 | while (![[AMIDEHelper getCurrentEditFilePath] isEqualToString:mfilePath]) { 131 | [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; 132 | } 133 | 134 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 135 | NSString *mFileText = textView.textStorage.string; 136 | NSRange contentRange = [AMIDEHelper getClassImplementContentRangeWithClassNameItemList:currentClassName fileText:mFileText fileType:AMIDEFileTypeMFile]; 137 | 138 | 139 | NSRegularExpression *regex = [NSRegularExpression 140 | regularExpressionWithPattern:_declareMap[matchIndex] 141 | options:NSRegularExpressionAnchorsMatchLines|NSRegularExpressionDotMatchesLineSeparators 142 | error:NULL]; 143 | NSTextCheckingResult *textCheckingResult = [regex firstMatchInString:methodItem options:0 range:NSMakeRange(0, methodItem.length)]; 144 | if (textCheckingResult.range.location != NSNotFound) { 145 | NSString *result = [methodItem substringWithRange:[textCheckingResult rangeAtIndex:textCheckingResult.numberOfRanges-1]]; 146 | 147 | 148 | 149 | BOOL isImplementFound = NO; 150 | if (matchIndex == AMImplementTypeMethod) { 151 | 152 | NSRange textRange = [mFileText rangeOfString:methodItem options:NSCaseInsensitiveSearch]; 153 | isImplementFound = textRange.location != NSNotFound; 154 | 155 | } else if (matchIndex == AMImplementTypeConstString) { 156 | 157 | NSString *matchRegex = [NSString stringWithFormat:_implementMap[matchIndex], result]; 158 | isImplementFound = [mFileText matches:matchRegex range:contentRange]; 159 | 160 | } 161 | 162 | if (isImplementFound) { 163 | if (selectTextDictionary == nil) { 164 | selectTextDictionary = @{kSelectTextType:@(matchIndex), 165 | kSelectTextFirstSelectMethod:matchIndex==AMImplementTypeMethod?methodItem:[NSString stringWithFormat:_implementMap[matchIndex], result]}; 166 | } 167 | }else { 168 | if (shouldSelect) { 169 | selectTextDictionary = @{kSelectTextType:@(matchIndex), 170 | kSelectTextFirstSelectMethod:matchIndex==AMImplementTypeMethod?methodItem:[NSString stringWithFormat:_implementMap[matchIndex], result]}; 171 | shouldSelect = NO; 172 | } 173 | 174 | [stringResult appendFormat:_implementContent[matchIndex], result]; 175 | NSLog(@"Result:%@", result); 176 | } 177 | 178 | } 179 | } 180 | } 181 | 182 | if (stringResult.length > 0) { 183 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 184 | NSRange contentRange = [AMIDEHelper getClassImplementContentRangeWithClassNameItemList:currentClassName fileText:textView.textStorage.string fileType:AMIDEFileTypeMFile]; 185 | NSRange range = [AMIDEHelper getInsertRangeWithClassImplementContentRange:contentRange]; 186 | [textView insertText:[stringResult stringByAppendingString:@"\n"] replacementRange:range]; 187 | } 188 | 189 | if (selectTextDictionary != nil) { 190 | NSInteger type = [selectTextDictionary[kSelectTextType] integerValue]; 191 | if (type == AMImplementTypeMethod) { 192 | NSString *trimString = [selectTextDictionary[kSelectTextFirstSelectMethod] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 193 | [AMIDEHelper selectText:trimString]; 194 | }else if (type == AMImplementTypeConstString){ 195 | [AMIDEHelper selectTextWithRegex:selectTextDictionary[kSelectTextFirstSelectMethod] highlightText:@"<#value#>"]; 196 | } 197 | } 198 | } 199 | 200 | - (void)declareMethod:(NSString *)selectString{ 201 | 202 | NSInteger matchIndex = [selectString getMatchIndexWithRegexList:_declareMap]; 203 | if (matchIndex != -1) 204 | { 205 | 206 | if (matchIndex == AMImplementTypeMethod) { 207 | NSArray *currentClassName = [AMIDEHelper getCurrentClassNameByCurrentSelectedRangeWithFileType:AMIDEFileTypeMFile]; 208 | NSString *hfilePath = [AMIDEHelper getHFilePathOfCurrentEditFile]; 209 | [AMIDEHelper openFile:hfilePath]; 210 | 211 | while (![[AMIDEHelper getCurrentEditFilePath] isEqualToString:hfilePath]) { 212 | [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; 213 | } 214 | 215 | 216 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 217 | NSString *hFileText = textView.textStorage.string; 218 | NSRange trimStringRange = [selectString rangeOfString:@"{"]; 219 | if (trimStringRange.location != NSNotFound) { 220 | selectString = [selectString substringWithRange:NSMakeRange(0, trimStringRange.location)]; 221 | NSLog(@"#2trimString: %@", selectString); 222 | } 223 | NSString *trimString = [selectString removeSpaceAndNewline]; 224 | NSString *declareMethod = [trimString stringByAppendingString:@";"]; 225 | NSRange contentRange = [AMIDEHelper getClassImplementContentRangeWithClassNameItemList:currentClassName fileText:hFileText fileType:AMIDEFileTypeHFile]; 226 | NSRange textRange = [hFileText rangeOfString:trimString options:NSCaseInsensitiveSearch range:contentRange]; 227 | if (textRange.location == NSNotFound) 228 | { 229 | 230 | NSRange range = [AMIDEHelper getInsertRangeWithClassImplementContentRange:contentRange]; 231 | if (range.location != NSNotFound) { 232 | [textView insertText:[NSString stringWithFormat:@"\n%@\n", declareMethod] replacementRange:range]; 233 | 234 | } 235 | 236 | } 237 | [AMIDEHelper selectText:declareMethod]; 238 | 239 | }else if (matchIndex == AMImplementTypeSelector) { 240 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 241 | NSString *fileText = textView.textStorage.string; 242 | NSRegularExpression *regex = [NSRegularExpression 243 | regularExpressionWithPattern:_declareMap[matchIndex] 244 | options:NSRegularExpressionAnchorsMatchLines|NSRegularExpressionDotMatchesLineSeparators 245 | error:NULL]; 246 | NSTextCheckingResult *textCheckingResult = [regex firstMatchInString:selectString options:0 range:NSMakeRange(0, selectString.length)]; 247 | if (textCheckingResult.range.location != NSNotFound) { 248 | NSString *result = [selectString substringWithRange:[textCheckingResult rangeAtIndex:textCheckingResult.numberOfRanges-1]]; 249 | if (result.length > 0) { 250 | NSUInteger index = [result rangeOfString:@":"].location == NSNotFound ? 0 : 1; 251 | NSString *matchRegex = [NSString stringWithFormat:_implementMap[matchIndex][index], result]; 252 | NSString *stringResult = [NSString stringWithFormat:_implementContent[matchIndex][index], result]; 253 | BOOL isImplementFound = [fileText matches:matchRegex range:NSMakeRange(0, fileText.length)]; 254 | if (!isImplementFound) { 255 | NSArray *currentClassName = [AMIDEHelper getCurrentClassNameByCurrentSelectedRangeWithFileType:AMIDEFileTypeMFile]; 256 | NSRange contentRange = [AMIDEHelper getClassImplementContentRangeWithClassNameItemList:currentClassName fileText:fileText fileType:AMIDEFileTypeMFile]; 257 | NSRange range = [AMIDEHelper getInsertRangeWithClassImplementContentRange:contentRange]; 258 | [textView insertText:[stringResult stringByAppendingString:@"\n"] replacementRange:range]; 259 | } 260 | [AMIDEHelper selectTextWithRegex:matchRegex highlightText:@""]; 261 | } 262 | } 263 | }else if (matchIndex == AMImplementTypeInvocation) { 264 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 265 | NSString *fileText = textView.textStorage.string; 266 | NSRegularExpression *regex = [NSRegularExpression 267 | regularExpressionWithPattern:_declareMap[matchIndex] 268 | options:NSRegularExpressionAnchorsMatchLines|NSRegularExpressionDotMatchesLineSeparators 269 | error:NULL]; 270 | NSTextCheckingResult *textCheckingResult = [regex firstMatchInString:selectString options:0 range:NSMakeRange(0, selectString.length)]; 271 | if (textCheckingResult.range.location != NSNotFound) { 272 | NSString *result = [selectString substringWithRange:[textCheckingResult rangeAtIndex:textCheckingResult.numberOfRanges-1]]; 273 | if (result.length > 0) { 274 | NSString *matchRegex = [NSString stringWithFormat:_implementMap[matchIndex], result]; 275 | BOOL isImplementFound = [fileText matches:matchRegex range:NSMakeRange(0, fileText.length)]; 276 | NSString *stringResult = [NSString stringWithFormat:_implementContent[matchIndex], result]; 277 | if (!isImplementFound) { 278 | NSArray *currentClassName = [AMIDEHelper getCurrentClassNameByCurrentSelectedRangeWithFileType:AMIDEFileTypeMFile]; 279 | NSRange contentRange = [AMIDEHelper getClassImplementContentRangeWithClassNameItemList:currentClassName fileText:fileText fileType:AMIDEFileTypeMFile]; 280 | NSRange range = [AMIDEHelper getInsertRangeWithClassImplementContentRange:contentRange]; 281 | [textView insertText:[stringResult stringByAppendingString:@"\n"] replacementRange:range]; 282 | } 283 | [AMIDEHelper selectTextWithRegex:matchRegex highlightText:@""]; 284 | } 285 | } 286 | }else if (matchIndex == AMImplementTypeGetter){ 287 | [self generateGetterMethod:selectString]; 288 | } 289 | } 290 | } 291 | 292 | // For menu item: 293 | - (void)doImplementMethodAction 294 | { 295 | 296 | BOOL isProcessFileType = [[AMIDEHelper getCurrentEditFilePath].pathExtension matches:@"[hm]|mm"]; 297 | if (!isProcessFileType) { 298 | return; 299 | } 300 | NSString *selectString = [AMIDEHelper getCurrentSelectMethod]; 301 | 302 | if ([AMIDEHelper isHeaderFile]) { 303 | 304 | [self implementMethod:selectString]; 305 | }else { 306 | [self declareMethod:selectString]; 307 | 308 | } 309 | } 310 | 311 | /** 312 | * create get method for selected properties 313 | */ 314 | - (void)generateGetterMethod:(NSString*)selectString 315 | { 316 | NSArray *currentClassName = [AMIDEHelper getCurrentClassNameByCurrentSelectedRangeWithFileType:AMIDEFileTypeHFile]; 317 | NSTextView *textView = [AMXcodeHelper currentSourceCodeTextView]; 318 | NSString *mFileText = textView.textStorage.string; 319 | NSRange contentRange = [AMIDEHelper getClassImplementContentRangeWithClassNameItemList:currentClassName fileText:mFileText fileType:AMIDEFileTypeMFile]; 320 | 321 | NSArray *methodList = [selectString componentsSeparatedByString:@";"]; 322 | NSMutableString *stringResult = [NSMutableString string]; 323 | for (NSString *methodItem in methodList) { 324 | if (methodItem.length == 0) { 325 | continue; 326 | } 327 | NSInteger matchIndex = [methodItem getMatchIndexWithRegexList:_declareMap]; 328 | if (matchIndex == -1) { 329 | continue; 330 | } 331 | 332 | NSRegularExpression *regex = [NSRegularExpression 333 | regularExpressionWithPattern:_declareMap[matchIndex] 334 | options:NSRegularExpressionAnchorsMatchLines|NSRegularExpressionDotMatchesLineSeparators 335 | error:NULL]; 336 | NSTextCheckingResult *textCheckingResult = [regex firstMatchInString:methodItem options:0 range:NSMakeRange(0, methodItem.length)]; 337 | if (textCheckingResult.range.location != NSNotFound) { 338 | 339 | NSString *variable = [methodItem substringWithRange:[textCheckingResult rangeAtIndex:textCheckingResult.numberOfRanges-1]]; 340 | NSString *variableType = [methodItem substringWithRange:[textCheckingResult rangeAtIndex:textCheckingResult.numberOfRanges-2]]; 341 | 342 | NSString *matchRegex = [NSString stringWithFormat:_implementMap[matchIndex], variable]; 343 | BOOL isImplementFound = [mFileText matches:matchRegex range:contentRange]; 344 | 345 | if (isImplementFound) { 346 | continue; 347 | } 348 | 349 | [stringResult appendFormat:_implementContent[matchIndex], variableType, variable,variable,variable]; 350 | } 351 | } 352 | 353 | if (stringResult.length > 0) { 354 | NSRange range = [AMIDEHelper getInsertRangeWithClassImplementContentRange:contentRange]; 355 | [textView insertText:[stringResult stringByAppendingString:@"\n"] replacementRange:range]; 356 | [AMIDEHelper selectText:stringResult]; 357 | } 358 | } 359 | 360 | - (void)showSettingWindow 361 | { 362 | if (self.settingWindowController == nil) { 363 | self.settingWindowController = [[AMSettingWindowController alloc] initWithWindowNibName:@"AMSettingWindowController"]; 364 | self.settingWindowController.bundle = self.bundle; 365 | 366 | } 367 | 368 | [self.settingWindowController showWindow:self.settingWindowController]; 369 | } 370 | 371 | - (void)dealloc 372 | { 373 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 374 | } 375 | 376 | @end 377 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMSettingWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // AMSetting.h 3 | // AMMethod2Implement 4 | // 5 | // Created by JohnnyLiu on 15/3/30. 6 | // Copyright (c) 2015年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AMSettingWindowController : NSWindowController 12 | 13 | @property (nonatomic, weak) NSBundle *bundle; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMSettingWindowController.m: -------------------------------------------------------------------------------- 1 | // 2 | // AMSetting.m 3 | // AMMethod2Implement 4 | // 5 | // Created by JohnnyLiu on 15/3/30. 6 | // Copyright (c) 2015年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import "AMSettingWindowController.h" 10 | #import "AMMenuGenerator.h" 11 | 12 | @interface AMSettingWindowController () 13 | 14 | @property (weak) IBOutlet NSPopUpButton *shortcutMask1; 15 | @property (weak) IBOutlet NSPopUpButton *shortcutMask2; 16 | @property (weak) IBOutlet NSTextField *controlTextField; 17 | 18 | @end 19 | 20 | @implementation AMSettingWindowController 21 | 22 | - (void)windowDidLoad { 23 | [super windowDidLoad]; 24 | NSDictionary *userMenu = [[NSUserDefaults standardUserDefaults] objectForKey:kMenuActionTitle]; 25 | if (userMenu != nil) { 26 | 27 | NSArray *items = userMenu[kMenuShortcut]; 28 | if (items.count == 1) { 29 | [self.shortcutMask1 selectItemWithTitle:items[0]]; 30 | } 31 | if (items.count == 2) { 32 | [self.shortcutMask1 selectItemWithTitle:items[0]]; 33 | [self.shortcutMask2 selectItemWithTitle:items[1]]; 34 | } 35 | self.controlTextField.stringValue = userMenu[kMenuKeyEquivalent]; 36 | 37 | } 38 | } 39 | 40 | - (IBAction)onApplyButtonClicked:(NSButton *)sender { 41 | 42 | NSMutableArray *maskKeys = [NSMutableArray array]; 43 | if (self.shortcutMask1.selectedItem.title != nil && self.shortcutMask1.selectedItem.title.length > 0) { 44 | [maskKeys addObject:self.shortcutMask1.selectedItem.title]; 45 | } 46 | if (self.shortcutMask2.selectedItem.title != nil && self.shortcutMask2.selectedItem.title.length > 0) { 47 | [maskKeys addObject:self.shortcutMask2.selectedItem.title]; 48 | } 49 | 50 | NSDictionary *menuItem = @{kMenuTitle:kMenuActionTitle, kMenuShortcut:maskKeys, kMenuKeyEquivalent:self.controlTextField.stringValue}; 51 | [[NSUserDefaults standardUserDefaults] setObject:menuItem forKey:kMenuActionTitle]; 52 | [[NSUserDefaults standardUserDefaults] synchronize]; 53 | [self close]; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMSettingWindowController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMXcodeHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // AMXcodeHelper.h 3 | // 4 | // 5 | // Created by Mellong on 14-4-13. 6 | // Copyright (c) 2014年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DVTTextDocumentLocation : NSObject 12 | @property (readonly) NSRange characterRange; 13 | @property (readonly) NSRange lineRange; 14 | @end 15 | 16 | @interface DVTTextPreferences : NSObject 17 | + (id)preferences; 18 | @property BOOL trimWhitespaceOnlyLines; 19 | @property BOOL trimTrailingWhitespace; 20 | @property BOOL useSyntaxAwareIndenting; 21 | @end 22 | 23 | @interface DVTSourceTextStorage : NSTextStorage 24 | - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)string withUndoManager:(id)undoManager; 25 | - (NSRange)lineRangeForCharacterRange:(NSRange)range; 26 | - (NSRange)characterRangeForLineRange:(NSRange)range; 27 | - (void)indentCharacterRange:(NSRange)range undoManager:(id)undoManager; 28 | @end 29 | 30 | @interface DVTFileDataType : NSObject 31 | @property (readonly) NSString *identifier; 32 | @end 33 | 34 | @interface DVTFilePath : NSObject 35 | @property (readonly) NSURL *fileURL; 36 | @property (readonly) DVTFileDataType *fileDataTypePresumed; 37 | @end 38 | 39 | @interface IDEContainerItem : NSObject 40 | @property (readonly) DVTFilePath *resolvedFilePath; 41 | @end 42 | 43 | @interface IDEGroup : IDEContainerItem 44 | 45 | @end 46 | 47 | @interface IDEFileReference : IDEContainerItem 48 | 49 | @end 50 | 51 | @interface IDENavigableItem : NSObject 52 | @property (readonly) IDENavigableItem *parentItem; 53 | @property (readonly) id representedObject; 54 | @end 55 | 56 | @interface IDEFileNavigableItem : IDENavigableItem 57 | @property (readonly) DVTFileDataType *documentType; 58 | @property (readonly) NSURL *fileURL; 59 | @end 60 | 61 | @interface IDEStructureNavigator : NSObject 62 | @property (retain) NSArray *selectedObjects; 63 | @end 64 | 65 | @interface IDENavigableItemCoordinator : NSObject 66 | - (id)structureNavigableItemForDocumentURL:(id)arg1 inWorkspace:(id)arg2 error:(id *)arg3; 67 | @end 68 | 69 | @interface IDENavigatorArea : NSObject 70 | - (id)currentNavigator; 71 | @end 72 | 73 | @interface IDEWorkspaceTabController : NSObject 74 | @property (readonly) IDENavigatorArea *navigatorArea; 75 | @end 76 | 77 | @interface IDEDocumentController : NSDocumentController 78 | + (id)editorDocumentForNavigableItem:(id)arg1; 79 | + (id)retainedEditorDocumentForNavigableItem:(id)arg1 error:(id *)arg2; 80 | + (void)releaseEditorDocument:(id)arg1; 81 | @end 82 | 83 | @interface IDESourceCodeDocument : NSDocument 84 | - (DVTSourceTextStorage *)textStorage; 85 | - (NSUndoManager *)undoManager; 86 | @end 87 | 88 | @interface IDESourceCodeComparisonEditor : NSObject 89 | @property (readonly) NSTextView *keyTextView; 90 | @property (retain) NSDocument *primaryDocument; 91 | @end 92 | 93 | @interface IDESourceCodeEditor : NSObject 94 | @property (retain) NSTextView *textView; 95 | - (IDESourceCodeDocument *)sourceCodeDocument; 96 | @end 97 | 98 | @interface IDEEditorContext : NSObject 99 | - (id)editor; // returns the current editor. If the editor is the code editor, the class is `IDESourceCodeEditor` 100 | @end 101 | 102 | @interface IDEEditorArea : NSObject 103 | - (IDEEditorContext *)lastActiveEditorContext; 104 | @end 105 | 106 | @interface IDEWorkspaceWindowController : NSObject 107 | @property (readonly) IDEWorkspaceTabController *activeWorkspaceTabController; 108 | - (IDEEditorArea *)editorArea; 109 | @end 110 | 111 | @interface IDEWorkspace : NSObject 112 | @property (readonly) DVTFilePath *representingFilePath; 113 | @end 114 | 115 | @interface IDEWorkspaceDocument : NSDocument 116 | @property (readonly) IDEWorkspace *workspace; 117 | @end 118 | 119 | @interface AMXcodeHelper : NSObject 120 | + (IDEWorkspaceDocument *)currentWorkspaceDocument; 121 | + (IDESourceCodeDocument *)currentSourceCodeDocument; 122 | + (NSTextView *)currentSourceCodeTextView; 123 | + (NSArray *)selectedObjCFileNavigableItems; 124 | @end 125 | 126 | -------------------------------------------------------------------------------- /AMMethod2Implement/AMXcodeHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // AMXcodeHelper.m 3 | // 4 | // 5 | // Created by Mellong on 14-4-13. 6 | // Copyright (c) 2014年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import "AMXcodeHelper.h" 10 | 11 | @implementation AMXcodeHelper 12 | 13 | #pragma mark - Helpers 14 | 15 | + (id)currentEditor { 16 | NSWindowController *currentWindowController = [[NSApp keyWindow] windowController]; 17 | if ([currentWindowController isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) { 18 | IDEWorkspaceWindowController *workspaceController = (IDEWorkspaceWindowController *)currentWindowController; 19 | IDEEditorArea *editorArea = [workspaceController editorArea]; 20 | IDEEditorContext *editorContext = [editorArea lastActiveEditorContext]; 21 | return [editorContext editor]; 22 | } 23 | return nil; 24 | } 25 | 26 | + (IDEWorkspaceDocument *)currentWorkspaceDocument { 27 | NSWindowController *currentWindowController = [[NSApp keyWindow] windowController]; 28 | id document = [currentWindowController document]; 29 | if (currentWindowController && [document isKindOfClass:NSClassFromString(@"IDEWorkspaceDocument")]) { 30 | return (IDEWorkspaceDocument *)document; 31 | } 32 | return nil; 33 | } 34 | 35 | + (IDESourceCodeDocument *)currentSourceCodeDocument { 36 | if ([[AMXcodeHelper currentEditor] isKindOfClass:NSClassFromString(@"IDESourceCodeEditor")]) { 37 | IDESourceCodeEditor *editor = [AMXcodeHelper currentEditor]; 38 | return editor.sourceCodeDocument; 39 | } 40 | 41 | if ([[AMXcodeHelper currentEditor] isKindOfClass:NSClassFromString(@"IDESourceCodeComparisonEditor")]) { 42 | IDESourceCodeComparisonEditor *editor = [AMXcodeHelper currentEditor]; 43 | if ([[editor primaryDocument] isKindOfClass:NSClassFromString(@"IDESourceCodeDocument")]) { 44 | IDESourceCodeDocument *document = (IDESourceCodeDocument *)editor.primaryDocument; 45 | return document; 46 | } 47 | } 48 | 49 | return nil; 50 | } 51 | 52 | + (NSTextView *)currentSourceCodeTextView { 53 | if ([[AMXcodeHelper currentEditor] isKindOfClass:NSClassFromString(@"IDESourceCodeEditor")]) { 54 | IDESourceCodeEditor *editor = [AMXcodeHelper currentEditor]; 55 | return editor.textView; 56 | } 57 | 58 | if ([[AMXcodeHelper currentEditor] isKindOfClass:NSClassFromString(@"IDESourceCodeComparisonEditor")]) { 59 | IDESourceCodeComparisonEditor *editor = [AMXcodeHelper currentEditor]; 60 | return editor.keyTextView; 61 | } 62 | 63 | return nil; 64 | } 65 | 66 | + (NSArray *)selectedObjCFileNavigableItems { 67 | NSMutableArray *mutableArray = [NSMutableArray array]; 68 | 69 | id currentWindowController = [[NSApp keyWindow] windowController]; 70 | if ([currentWindowController isKindOfClass:NSClassFromString(@"IDEWorkspaceWindowController")]) { 71 | IDEWorkspaceWindowController *workspaceController = currentWindowController; 72 | IDEWorkspaceTabController *workspaceTabController = [workspaceController activeWorkspaceTabController]; 73 | IDENavigatorArea *navigatorArea = [workspaceTabController navigatorArea]; 74 | id currentNavigator = [navigatorArea currentNavigator]; 75 | 76 | if ([currentNavigator isKindOfClass:NSClassFromString(@"IDEStructureNavigator")]) { 77 | IDEStructureNavigator *structureNavigator = currentNavigator; 78 | for (id selectedObject in structureNavigator.selectedObjects) { 79 | if ([selectedObject isKindOfClass:NSClassFromString(@"IDEFileNavigableItem")]) { 80 | IDEFileNavigableItem *fileNavigableItem = selectedObject; 81 | NSString *uti = fileNavigableItem.documentType.identifier; 82 | if ([uti isEqualToString:(NSString *)kUTTypeObjectiveCSource] || [uti isEqualToString:(NSString *)kUTTypeCHeader]) { 83 | [mutableArray addObject:fileNavigableItem]; 84 | } 85 | } 86 | } 87 | } 88 | } 89 | 90 | if (mutableArray.count) { 91 | return [NSArray arrayWithArray:mutableArray]; 92 | } 93 | return nil; 94 | } 95 | 96 | + (NSArray *)containerFolderURLsForNavigableItem:(IDENavigableItem *)navigableItem { 97 | NSMutableArray *mArray = [NSMutableArray array]; 98 | 99 | do { 100 | NSURL *folderURL = nil; 101 | id representedObject = navigableItem.representedObject; 102 | if ([navigableItem isKindOfClass:NSClassFromString(@"IDEGroupNavigableItem")]) { 103 | // IDE-GROUP (a folder in the navigator) 104 | IDEGroup *group = (IDEGroup *)representedObject; 105 | folderURL = group.resolvedFilePath.fileURL; 106 | } else if ([navigableItem isKindOfClass:NSClassFromString(@"IDEContainerFileReferenceNavigableItem")]) { 107 | // CONTAINER (an Xcode project) 108 | IDEFileReference *fileReference = representedObject; 109 | folderURL = [fileReference.resolvedFilePath.fileURL URLByDeletingLastPathComponent]; 110 | } else if ([navigableItem isKindOfClass:NSClassFromString(@"IDEKeyDrivenNavigableItem")]) { 111 | // WORKSPACE (root: Xcode project or workspace) 112 | IDEWorkspace *workspace = representedObject; 113 | folderURL = [workspace.representingFilePath.fileURL URLByDeletingLastPathComponent]; 114 | } 115 | if (folderURL && ![mArray containsObject:folderURL]) [mArray addObject:folderURL]; 116 | navigableItem = [navigableItem parentItem]; 117 | } while (navigableItem != nil); 118 | 119 | if (mArray.count > 0) return [NSArray arrayWithArray:mArray]; 120 | return nil; 121 | } 122 | 123 | @end 124 | -------------------------------------------------------------------------------- /AMMethod2Implement/MenuItemData.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | rootMenuTitle 6 | Edit 7 | pluginTitle 8 | AMMethod2Implement 9 | subMenuItems 10 | 11 | 12 | title 13 | Implement Mehod 14 | selector 15 | doImplementMethodAction 16 | shortcut 17 | 18 | keyMask 19 | 20 | ctrl 21 | 22 | keyEquivalent 23 | a 24 | 25 | 26 | 27 | title 28 | Setting 29 | selector 30 | showSettingWindow 31 | 32 | 33 | title 34 | Plugin version %@ 35 | selector 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /AMMethod2Implement/NSStringAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSStringAdditions.h 3 | // AMMethod2Implement 4 | // 5 | // Created by Long on 14-4-15. 6 | // Copyright (c) 2014年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | 10 | #import 11 | 12 | @interface NSString (Additions) 13 | 14 | 15 | - (BOOL)matches:(NSString *)regex; 16 | - (BOOL)matches:(NSString *)regex range:(NSRange)searchRange; 17 | 18 | /** 19 | * Search with regex and return first match range result. 20 | * 21 | * @param regex regex string. 22 | * 23 | * @return first match range result 24 | */ 25 | - (NSRange)firstMatch:(NSString *)regex; 26 | - (NSInteger)getMatchIndexWithRegexList:(NSArray *)regexList; 27 | 28 | - (NSString *)removeSpaceAndNewline; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /AMMethod2Implement/NSStringAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSStringAdditions.m 3 | // AMMethod2Implement 4 | // 5 | // Created by Long on 14-4-15. 6 | // Copyright (c) 2014年 Tendencystudio. All rights reserved. 7 | // 8 | 9 | #import "NSStringAdditions.h" 10 | 11 | @implementation NSString (Additions) 12 | 13 | - (BOOL)matches:(NSString *)regex 14 | { 15 | 16 | return [self matches:regex range:NSMakeRange(0, self.length)]; 17 | } 18 | 19 | - (BOOL)matches:(NSString *)regex range:(NSRange)searchRange 20 | { 21 | 22 | NSRegularExpression *regularExpression = [NSRegularExpression 23 | regularExpressionWithPattern:regex 24 | options:NSRegularExpressionAnchorsMatchLines 25 | error:NULL]; 26 | BOOL isMatch = [regularExpression numberOfMatchesInString:self options:0 range:searchRange] > 0; 27 | return isMatch; 28 | } 29 | 30 | - (NSInteger)getMatchIndexWithRegexList:(NSArray *)regexList 31 | { 32 | int i = 0; 33 | for (NSString *regexItem in regexList) { 34 | if ([self matches:regexItem]) { 35 | return i; 36 | } 37 | i++; 38 | } 39 | return -1; 40 | } 41 | 42 | - (NSRange)firstMatch:(NSString *)regex 43 | { 44 | 45 | NSRegularExpression *regularExpression = [NSRegularExpression 46 | regularExpressionWithPattern:regex 47 | options:NSRegularExpressionAnchorsMatchLines 48 | error:NULL]; 49 | NSTextCheckingResult *result = [regularExpression firstMatchInString:self options:0 range:NSMakeRange(0, self.length)]; 50 | return result.range; 51 | } 52 | 53 | - (NSString *)removeSpaceAndNewline 54 | { 55 | NSString *temp = [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; 56 | NSString *text = [temp stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; 57 | return text; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /AMMethod2Implement/RegexData.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | declareMap 6 | 7 | ^([-+]\s*\(\w+\s*\**\)\s*.+)$ 8 | ^extern\s+NSString\s*\*\s*const\s+(\w+)$ 9 | \@selector\((\w+\:?)\) 10 | \[self\s+(\w+)\]; 11 | \@property\s*\(nonatomic,\s*(\w+)\)\s*(\w+)\s*\*\s*(\w+) 12 | 13 | implementMap 14 | 15 | 16 | ^NSString\s*\*\s*const\s+%@\s*\=\s*\@\"(.*)\";$ 17 | 18 | ^(-\s*\(void\)\s*%@) 19 | ^(-\s*\(void\)\s*%@\s*\(\w+\s*\**\)\s*\w+) 20 | 21 | - \(\w+\s*\*?\)(%@)\s*\{? 22 | -\s*\(\w+\s*\*\)\s*%@\s*\{? 23 | 24 | implementContent 25 | 26 | \n\n%@ {\n\t\n} 27 | \n\nNSString * const %@ = @"<#value#>"; 28 | 29 | \n\n- (void)%@ {\n\t\n} 30 | \n\n- (void)%@(id)sender {\n\t\n} 31 | 32 | \n\n- (void)%@ {\n\t\n} 33 | \n\n- (%@ *)%@\n{\n\tif (!_%@){\n\n\t}\n\treturn _%@;\n} 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /AMMethod2Implement/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Mellong Lau 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![AMMethod2Implement Banner](https://raw.github.com/MellongLau/AMMethod2Implement/master/Screenshots/banner.png) 2 | 3 | AMMethod2Implement 4 | ================== 5 | 6 |

7 | 8 | Build Status 9 | Platform: Xcode 6+ 10 | License: MIT 11 | 12 |

13 | 14 | A simple Xcode plugin to generate implement code for the selected method, selector and const string, currently, only support objective-c. 15 | 16 | *可以自动的将.h或者.m .mm里边需要写入的方法自动填充进来。可以选择要导入的方法,然后按 Ctrl+A 或者 Edit > AMMethod2Implement > Implement Method.就会自动填充方法.也可以自行设置快捷键。* 17 | 18 | **如果觉得这款插件不错的话请点击右上角的star和推荐给你的朋友,如果想即时了解到我的最新消息,请拉到底部扫描二维码关注我的公众号** 19 | 20 | Welcome to join in QQ group 5522740 for further discussion. 21 | 欢迎加入QQ群 5522740 交流iOS开发. 22 | 23 | ##Features(v3.4): 24 | 25 | 1. Support `extern NSString * const` implement. 26 | 2. Support multiline method and const string implement. 27 | 3. Support categories. 28 | 4. Support declare method. 29 | 5. Support `@select(method:)` implement. 30 | 6. Support selector with none parameter. 31 | 7. Support changing the keyboard shortcut. 32 | 8. Support parameterless method invocation(New). 33 | 9. Support get method for property if get method not exist(New). 34 | 35 | *目前版本支持h文件声明方法自动生成实现,m或者mm文件已写好的方法生成方法声明到h文件, `extern NSString * const`, `@select(method:)` 和 `[self methodName]` 实现代码生成* 36 | 37 | ## Usage 38 | 39 | Use key `Ctrl+A` or go to menu `Edit` > `AMMethod2Implement` > `Implement Method`. 40 | 41 | 1. Multiline method and const string implement. 42 | ![usageScreenshot.gif](https://raw.github.com/MellongLau/AMMethod2Implement/master/Screenshots/usageScreenshot.gif) 43 | 44 | 2. Declare method. 45 | ![declare_method.gif](https://raw.github.com/MellongLau/AMMethod2Implement/master/Screenshots/declare_method.gif) 46 | 47 | 3. Implement selector. 48 | ![implement_selector.gif](https://raw.github.com/MellongLau/AMMethod2Implement/master/Screenshots/implement_selector.gif) 49 | 50 | ## Install 51 | 52 | You can: 53 | 54 | Install from github. 55 | 56 | * Get the source code from github 57 | 58 | `$ git clone git@github.com:MellongLau/AMMethod2Implement.git` 59 | 60 | * Build the AMMethod2Implement target in the Xcode project and the plug-in will automatically be installed in `~/Library/Application Support/Developer/Shared/Xcode/Plug-ins`. 61 | * Relaunch Xcode. 62 | 63 | or 64 | 65 | Install via [Alcatraz](http://alcatraz.io/) 66 | 67 | ![AMMethodImplementInAlcatraz.png](https://raw.github.com/MellongLau/AMMethod2Implement/master/Screenshots/AMMethodImplementInAlcatraz.png) 68 | 69 | In any case, relaunch Xcode to load it. 70 | 71 | 72 | ## Support 73 | 74 | Developed and tested against Xcode 6+. 75 | 76 | After upgrade your Xcode, you may need to run below shell script to add your current Xcode DVTPlugInCompatibilityUUID to all the Xcode plugins: 77 | 78 | > curl https://raw.githubusercontent.com/cielpy/RPAXU/master/refreshPluginsAfterXcodeUpgrading.sh | sh 79 | 80 | 81 | ## Thanks 82 | - (@HelloZJW)[https://github.com/HelloZJW] [Added get method for property if get method not exist] 83 | 84 | ## Todo 85 | 86 | 1. Support selector with multi parameters. 87 | 2. Support method invocation with multi parameters. 88 | 89 | 90 | ## More 91 | Learn more? Follow my `WeChat` public account `mellong`: 92 | 93 | ![WeChat QRcode](http://www.devlong.com/blogImages/qrcode_for_mellong.jpg) 94 | 95 | ## License 96 | 97 | MIT License 98 | 99 | Copyright (c) 2014 Mellong Lau 100 | 101 | Permission is hereby granted, free of charge, to any person obtaining a copy 102 | of this software and associated documentation files (the "Software"), to deal 103 | in the Software without restriction, including without limitation the rights 104 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 105 | copies of the Software, and to permit persons to whom the Software is 106 | furnished to do so, subject to the following conditions: 107 | 108 | The above copyright notice and this permission notice shall be included in all 109 | copies or substantial portions of the Software. 110 | 111 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 112 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 113 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 114 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 115 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 116 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 117 | SOFTWARE. 118 | -------------------------------------------------------------------------------- /Screenshots/AMMethodImplementInAlcatraz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellongLau/AMMethod2Implement/5a966f5436d9b49db8215afa2635cadaf575787f/Screenshots/AMMethodImplementInAlcatraz.png -------------------------------------------------------------------------------- /Screenshots/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellongLau/AMMethod2Implement/5a966f5436d9b49db8215afa2635cadaf575787f/Screenshots/banner.png -------------------------------------------------------------------------------- /Screenshots/declare_method.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellongLau/AMMethod2Implement/5a966f5436d9b49db8215afa2635cadaf575787f/Screenshots/declare_method.gif -------------------------------------------------------------------------------- /Screenshots/implement_selector.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellongLau/AMMethod2Implement/5a966f5436d9b49db8215afa2635cadaf575787f/Screenshots/implement_selector.gif -------------------------------------------------------------------------------- /Screenshots/usageScreenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MellongLau/AMMethod2Implement/5a966f5436d9b49db8215afa2635cadaf575787f/Screenshots/usageScreenshot.gif --------------------------------------------------------------------------------