├── MakeTheMacGreatAgain.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcshareddata │ └── xcschemes │ └── MakeTheMacGreatAgain.xcscheme ├── MakeTheMacGreatAgain ├── Info.plist ├── JRSwizzle.h ├── JRSwizzle.m ├── JRSwizzle_license.md ├── MakeTheMacGreatAgain.h ├── MakeTheMacGreatAgain.m ├── NSObject_Extension.h ├── NSObject_Extension.m └── screenshot.png ├── license.md └── readme.md /MakeTheMacGreatAgain.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BF2F268B1CC0469000372DAE /* JRSwizzle.m in Sources */ = {isa = PBXBuildFile; fileRef = BF2F268A1CC0469000372DAE /* JRSwizzle.m */; }; 11 | BFA316781CC0445700C134DE /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFA316771CC0445700C134DE /* AppKit.framework */; }; 12 | BFA3167A1CC0445700C134DE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFA316791CC0445700C134DE /* Foundation.framework */; }; 13 | BFA3167E1CC0445700C134DE /* MakeTheMacGreatAgain.xcscheme in Resources */ = {isa = PBXBuildFile; fileRef = BFA3167D1CC0445700C134DE /* MakeTheMacGreatAgain.xcscheme */; }; 14 | BFA316811CC0445700C134DE /* MakeTheMacGreatAgain.m in Sources */ = {isa = PBXBuildFile; fileRef = BFA316801CC0445700C134DE /* MakeTheMacGreatAgain.m */; }; 15 | BFA316841CC0445700C134DE /* NSObject_Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = BFA316831CC0445700C134DE /* NSObject_Extension.m */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | BF2F26891CC0469000372DAE /* JRSwizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JRSwizzle.h; sourceTree = ""; }; 20 | BF2F268A1CC0469000372DAE /* JRSwizzle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JRSwizzle.m; sourceTree = ""; }; 21 | BF5300A51CC61C8D0019B30E /* license.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = license.md; sourceTree = ""; }; 22 | BF5300A61CC61CA20019B30E /* JRSwizzle_license.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = JRSwizzle_license.md; sourceTree = ""; }; 23 | BF71A5C71CC052A400CC5EE0 /* screenshot.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = screenshot.png; sourceTree = ""; }; 24 | BF71A5C81CC053B800CC5EE0 /* readme.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = readme.md; sourceTree = SOURCE_ROOT; }; 25 | BFA316741CC0445700C134DE /* MakeTheMacGreatAgain.xcplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MakeTheMacGreatAgain.xcplugin; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | BFA316771CC0445700C134DE /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 27 | BFA316791CC0445700C134DE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 28 | BFA3167D1CC0445700C134DE /* MakeTheMacGreatAgain.xcscheme */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = MakeTheMacGreatAgain.xcscheme; path = MakeTheMacGreatAgain.xcodeproj/xcshareddata/xcschemes/MakeTheMacGreatAgain.xcscheme; sourceTree = SOURCE_ROOT; }; 29 | BFA3167F1CC0445700C134DE /* MakeTheMacGreatAgain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MakeTheMacGreatAgain.h; sourceTree = ""; }; 30 | BFA316801CC0445700C134DE /* MakeTheMacGreatAgain.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MakeTheMacGreatAgain.m; sourceTree = ""; }; 31 | BFA316821CC0445700C134DE /* NSObject_Extension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NSObject_Extension.h; sourceTree = ""; }; 32 | BFA316831CC0445700C134DE /* NSObject_Extension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NSObject_Extension.m; sourceTree = ""; }; 33 | BFA316851CC0445700C134DE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | BFA316721CC0445700C134DE /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | BFA316781CC0445700C134DE /* AppKit.framework in Frameworks */, 42 | BFA3167A1CC0445700C134DE /* Foundation.framework in Frameworks */, 43 | ); 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXFrameworksBuildPhase section */ 47 | 48 | /* Begin PBXGroup section */ 49 | BFA3166B1CC0445700C134DE = { 50 | isa = PBXGroup; 51 | children = ( 52 | BF71A5C81CC053B800CC5EE0 /* readme.md */, 53 | BF5300A51CC61C8D0019B30E /* license.md */, 54 | BFA3167B1CC0445700C134DE /* MakeTheMacGreatAgain */, 55 | BFA316761CC0445700C134DE /* Frameworks */, 56 | BFA316751CC0445700C134DE /* Products */, 57 | ); 58 | sourceTree = ""; 59 | }; 60 | BFA316751CC0445700C134DE /* Products */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | BFA316741CC0445700C134DE /* MakeTheMacGreatAgain.xcplugin */, 64 | ); 65 | name = Products; 66 | sourceTree = ""; 67 | }; 68 | BFA316761CC0445700C134DE /* Frameworks */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | BFA316771CC0445700C134DE /* AppKit.framework */, 72 | BFA316791CC0445700C134DE /* Foundation.framework */, 73 | ); 74 | name = Frameworks; 75 | sourceTree = ""; 76 | }; 77 | BFA3167B1CC0445700C134DE /* MakeTheMacGreatAgain */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | BFA3167F1CC0445700C134DE /* MakeTheMacGreatAgain.h */, 81 | BFA316801CC0445700C134DE /* MakeTheMacGreatAgain.m */, 82 | BFA316821CC0445700C134DE /* NSObject_Extension.h */, 83 | BFA316831CC0445700C134DE /* NSObject_Extension.m */, 84 | BF2F26891CC0469000372DAE /* JRSwizzle.h */, 85 | BF2F268A1CC0469000372DAE /* JRSwizzle.m */, 86 | BF5300A61CC61CA20019B30E /* JRSwizzle_license.md */, 87 | BFA316851CC0445700C134DE /* Info.plist */, 88 | BF71A5C71CC052A400CC5EE0 /* screenshot.png */, 89 | BFA3167C1CC0445700C134DE /* Supporting Files */, 90 | ); 91 | path = MakeTheMacGreatAgain; 92 | sourceTree = ""; 93 | }; 94 | BFA3167C1CC0445700C134DE /* Supporting Files */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | BFA3167D1CC0445700C134DE /* MakeTheMacGreatAgain.xcscheme */, 98 | ); 99 | name = "Supporting Files"; 100 | sourceTree = ""; 101 | }; 102 | /* End PBXGroup section */ 103 | 104 | /* Begin PBXNativeTarget section */ 105 | BFA316731CC0445700C134DE /* MakeTheMacGreatAgain */ = { 106 | isa = PBXNativeTarget; 107 | buildConfigurationList = BFA316881CC0445700C134DE /* Build configuration list for PBXNativeTarget "MakeTheMacGreatAgain" */; 108 | buildPhases = ( 109 | BFA316701CC0445700C134DE /* Sources */, 110 | BFA316711CC0445700C134DE /* Resources */, 111 | BFA316721CC0445700C134DE /* Frameworks */, 112 | ); 113 | buildRules = ( 114 | ); 115 | dependencies = ( 116 | ); 117 | name = MakeTheMacGreatAgain; 118 | productName = MakeTheMacGreatAgain; 119 | productReference = BFA316741CC0445700C134DE /* MakeTheMacGreatAgain.xcplugin */; 120 | productType = "com.apple.product-type.bundle"; 121 | }; 122 | /* End PBXNativeTarget section */ 123 | 124 | /* Begin PBXProject section */ 125 | BFA3166C1CC0445700C134DE /* Project object */ = { 126 | isa = PBXProject; 127 | attributes = { 128 | LastUpgradeCheck = 0730; 129 | ORGANIZATIONNAME = "BlackDog Foundry Pty Ltd"; 130 | TargetAttributes = { 131 | BFA316731CC0445700C134DE = { 132 | CreatedOnToolsVersion = 7.3; 133 | }; 134 | }; 135 | }; 136 | buildConfigurationList = BFA3166F1CC0445700C134DE /* Build configuration list for PBXProject "MakeTheMacGreatAgain" */; 137 | compatibilityVersion = "Xcode 3.2"; 138 | developmentRegion = English; 139 | hasScannedForEncodings = 0; 140 | knownRegions = ( 141 | en, 142 | ); 143 | mainGroup = BFA3166B1CC0445700C134DE; 144 | productRefGroup = BFA316751CC0445700C134DE /* Products */; 145 | projectDirPath = ""; 146 | projectRoot = ""; 147 | targets = ( 148 | BFA316731CC0445700C134DE /* MakeTheMacGreatAgain */, 149 | ); 150 | }; 151 | /* End PBXProject section */ 152 | 153 | /* Begin PBXResourcesBuildPhase section */ 154 | BFA316711CC0445700C134DE /* Resources */ = { 155 | isa = PBXResourcesBuildPhase; 156 | buildActionMask = 2147483647; 157 | files = ( 158 | BFA3167E1CC0445700C134DE /* MakeTheMacGreatAgain.xcscheme in Resources */, 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | }; 162 | /* End PBXResourcesBuildPhase section */ 163 | 164 | /* Begin PBXSourcesBuildPhase section */ 165 | BFA316701CC0445700C134DE /* Sources */ = { 166 | isa = PBXSourcesBuildPhase; 167 | buildActionMask = 2147483647; 168 | files = ( 169 | BFA316811CC0445700C134DE /* MakeTheMacGreatAgain.m in Sources */, 170 | BF2F268B1CC0469000372DAE /* JRSwizzle.m in Sources */, 171 | BFA316841CC0445700C134DE /* NSObject_Extension.m in Sources */, 172 | ); 173 | runOnlyForDeploymentPostprocessing = 0; 174 | }; 175 | /* End PBXSourcesBuildPhase section */ 176 | 177 | /* Begin XCBuildConfiguration section */ 178 | BFA316861CC0445700C134DE /* Debug */ = { 179 | isa = XCBuildConfiguration; 180 | buildSettings = { 181 | ALWAYS_SEARCH_USER_PATHS = NO; 182 | CLANG_ANALYZER_NONNULL = YES; 183 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 184 | CLANG_CXX_LIBRARY = "libc++"; 185 | CLANG_ENABLE_MODULES = YES; 186 | CLANG_ENABLE_OBJC_ARC = YES; 187 | CLANG_WARN_BOOL_CONVERSION = YES; 188 | CLANG_WARN_CONSTANT_CONVERSION = YES; 189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 190 | CLANG_WARN_EMPTY_BODY = YES; 191 | CLANG_WARN_ENUM_CONVERSION = YES; 192 | CLANG_WARN_INT_CONVERSION = YES; 193 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 194 | CLANG_WARN_UNREACHABLE_CODE = YES; 195 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 196 | COPY_PHASE_STRIP = NO; 197 | DEBUG_INFORMATION_FORMAT = dwarf; 198 | ENABLE_STRICT_OBJC_MSGSEND = YES; 199 | ENABLE_TESTABILITY = YES; 200 | GCC_C_LANGUAGE_STANDARD = gnu99; 201 | GCC_DYNAMIC_NO_PIC = NO; 202 | GCC_NO_COMMON_BLOCKS = YES; 203 | GCC_OPTIMIZATION_LEVEL = 0; 204 | GCC_PREPROCESSOR_DEFINITIONS = ( 205 | "DEBUG=1", 206 | "$(inherited)", 207 | ); 208 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 209 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 210 | GCC_WARN_UNDECLARED_SELECTOR = YES; 211 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 212 | GCC_WARN_UNUSED_FUNCTION = YES; 213 | GCC_WARN_UNUSED_VARIABLE = YES; 214 | MTL_ENABLE_DEBUG_INFO = YES; 215 | ONLY_ACTIVE_ARCH = YES; 216 | }; 217 | name = Debug; 218 | }; 219 | BFA316871CC0445700C134DE /* Release */ = { 220 | isa = XCBuildConfiguration; 221 | buildSettings = { 222 | ALWAYS_SEARCH_USER_PATHS = NO; 223 | CLANG_ANALYZER_NONNULL = YES; 224 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 225 | CLANG_CXX_LIBRARY = "libc++"; 226 | CLANG_ENABLE_MODULES = YES; 227 | CLANG_ENABLE_OBJC_ARC = YES; 228 | CLANG_WARN_BOOL_CONVERSION = YES; 229 | CLANG_WARN_CONSTANT_CONVERSION = YES; 230 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 231 | CLANG_WARN_EMPTY_BODY = YES; 232 | CLANG_WARN_ENUM_CONVERSION = YES; 233 | CLANG_WARN_INT_CONVERSION = YES; 234 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 235 | CLANG_WARN_UNREACHABLE_CODE = YES; 236 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 237 | COPY_PHASE_STRIP = NO; 238 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 239 | ENABLE_NS_ASSERTIONS = NO; 240 | ENABLE_STRICT_OBJC_MSGSEND = YES; 241 | GCC_C_LANGUAGE_STANDARD = gnu99; 242 | GCC_NO_COMMON_BLOCKS = YES; 243 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 244 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 245 | GCC_WARN_UNDECLARED_SELECTOR = YES; 246 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 247 | GCC_WARN_UNUSED_FUNCTION = YES; 248 | GCC_WARN_UNUSED_VARIABLE = YES; 249 | MTL_ENABLE_DEBUG_INFO = NO; 250 | }; 251 | name = Release; 252 | }; 253 | BFA316891CC0445700C134DE /* Debug */ = { 254 | isa = XCBuildConfiguration; 255 | buildSettings = { 256 | COMBINE_HIDPI_IMAGES = YES; 257 | DEPLOYMENT_LOCATION = YES; 258 | DSTROOT = "$(HOME)"; 259 | INFOPLIST_FILE = MakeTheMacGreatAgain/Info.plist; 260 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 261 | MACOSX_DEPLOYMENT_TARGET = 10.11; 262 | PRODUCT_BUNDLE_IDENTIFIER = com.blackdogfoundry.MakeTheMacGreatAgain; 263 | PRODUCT_NAME = "$(TARGET_NAME)"; 264 | WRAPPER_EXTENSION = xcplugin; 265 | }; 266 | name = Debug; 267 | }; 268 | BFA3168A1CC0445700C134DE /* Release */ = { 269 | isa = XCBuildConfiguration; 270 | buildSettings = { 271 | COMBINE_HIDPI_IMAGES = YES; 272 | DEPLOYMENT_LOCATION = YES; 273 | DSTROOT = "$(HOME)"; 274 | INFOPLIST_FILE = MakeTheMacGreatAgain/Info.plist; 275 | INSTALL_PATH = "/Library/Application Support/Developer/Shared/Xcode/Plug-ins"; 276 | MACOSX_DEPLOYMENT_TARGET = 10.11; 277 | PRODUCT_BUNDLE_IDENTIFIER = com.blackdogfoundry.MakeTheMacGreatAgain; 278 | PRODUCT_NAME = "$(TARGET_NAME)"; 279 | WRAPPER_EXTENSION = xcplugin; 280 | }; 281 | name = Release; 282 | }; 283 | /* End XCBuildConfiguration section */ 284 | 285 | /* Begin XCConfigurationList section */ 286 | BFA3166F1CC0445700C134DE /* Build configuration list for PBXProject "MakeTheMacGreatAgain" */ = { 287 | isa = XCConfigurationList; 288 | buildConfigurations = ( 289 | BFA316861CC0445700C134DE /* Debug */, 290 | BFA316871CC0445700C134DE /* Release */, 291 | ); 292 | defaultConfigurationIsVisible = 0; 293 | defaultConfigurationName = Release; 294 | }; 295 | BFA316881CC0445700C134DE /* Build configuration list for PBXNativeTarget "MakeTheMacGreatAgain" */ = { 296 | isa = XCConfigurationList; 297 | buildConfigurations = ( 298 | BFA316891CC0445700C134DE /* Debug */, 299 | BFA3168A1CC0445700C134DE /* Release */, 300 | ); 301 | defaultConfigurationIsVisible = 0; 302 | defaultConfigurationName = Release; 303 | }; 304 | /* End XCConfigurationList section */ 305 | }; 306 | rootObject = BFA3166C1CC0445700C134DE /* Project object */; 307 | } 308 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain.xcodeproj/xcshareddata/xcschemes/MakeTheMacGreatAgain.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 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | C4A681B0-4A26-480E-93EC-1218098B9AA0 28 | F41BD31E-2683-44B8-AE7F-5F09E919790E 29 | AD68E85B-441B-4301-B564-A45E4919A6AD 30 | A16FF353-8441-459E-A50C-B071F53F51B7 31 | 9F75337B-21B4-4ADC-B558-F9CADF7073A7 32 | E969541F-E6F9-4D25-8158-72DC3545A6C6 33 | 8DC44374-2B35-4C57-A6FE-2AD66A36AAD9 34 | AABB7188-E14E-4433-AD3B-5CD791EAD9A3 35 | 8DC44374-2B35-4C57-A6FE-2AD66A36AAD9 36 | AABB7188-E14E-4433-AD3B-5CD791EAD9A3 37 | 7FDF5C7A-131F-4ABB-9EDC-8C5F8F0B8A90 38 | 0420B86A-AA43-4792-9ED0-6FE0F2B16A13 39 | 7265231C-39B4-402C-89E1-16167C4CC990 40 | ACA8656B-FEA8-4B6D-8E4A-93F4C95C362C 41 | 42 | LSMinimumSystemVersion 43 | $(MACOSX_DEPLOYMENT_TARGET) 44 | NSPrincipalClass 45 | MakeTheMacGreatAgain 46 | XC4Compatible 47 | 48 | XCPluginHasUI 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain/JRSwizzle.h: -------------------------------------------------------------------------------- 1 | // JRSwizzle.h semver:1.0 2 | // Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com 3 | // Some rights reserved: http://opensource.org/licenses/MIT 4 | // https://github.com/rentzsch/jrswizzle 5 | 6 | #import 7 | 8 | @interface NSObject (JRSwizzle) 9 | 10 | + (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_; 11 | + (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain/JRSwizzle.m: -------------------------------------------------------------------------------- 1 | // JRSwizzle.m semver:1.0 2 | // Copyright (c) 2007-2011 Jonathan 'Wolf' Rentzsch: http://rentzsch.com 3 | // Some rights reserved: http://opensource.org/licenses/MIT 4 | // https://github.com/rentzsch/jrswizzle 5 | 6 | #import "JRSwizzle.h" 7 | 8 | #if TARGET_OS_IPHONE 9 | #import 10 | #import 11 | #else 12 | #import 13 | #endif 14 | 15 | #define SetNSErrorFor(FUNC, ERROR_VAR, FORMAT,...) \ 16 | if (ERROR_VAR) { \ 17 | NSString *errStr = [NSString stringWithFormat:@"%s: " FORMAT,FUNC,##__VA_ARGS__]; \ 18 | *ERROR_VAR = [NSError errorWithDomain:@"NSCocoaErrorDomain" \ 19 | code:-1 \ 20 | userInfo:[NSDictionary dictionaryWithObject:errStr forKey:NSLocalizedDescriptionKey]]; \ 21 | } 22 | #define SetNSError(ERROR_VAR, FORMAT,...) SetNSErrorFor(__func__, ERROR_VAR, FORMAT, ##__VA_ARGS__) 23 | 24 | #if OBJC_API_VERSION >= 2 25 | #define GetClass(obj) object_getClass(obj) 26 | #else 27 | #define GetClass(obj) (obj ? obj->isa : Nil) 28 | #endif 29 | 30 | @implementation NSObject (JRSwizzle) 31 | 32 | + (BOOL)jr_swizzleMethod:(SEL)origSel_ withMethod:(SEL)altSel_ error:(NSError**)error_ { 33 | #if OBJC_API_VERSION >= 2 34 | Method origMethod = class_getInstanceMethod(self, origSel_); 35 | if (!origMethod) { 36 | #if TARGET_OS_IPHONE 37 | SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self class]); 38 | #else 39 | SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); 40 | #endif 41 | return NO; 42 | } 43 | 44 | Method altMethod = class_getInstanceMethod(self, altSel_); 45 | if (!altMethod) { 46 | #if TARGET_OS_IPHONE 47 | SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self class]); 48 | #else 49 | SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); 50 | #endif 51 | return NO; 52 | } 53 | 54 | class_addMethod(self, 55 | origSel_, 56 | class_getMethodImplementation(self, origSel_), 57 | method_getTypeEncoding(origMethod)); 58 | class_addMethod(self, 59 | altSel_, 60 | class_getMethodImplementation(self, altSel_), 61 | method_getTypeEncoding(altMethod)); 62 | 63 | method_exchangeImplementations(class_getInstanceMethod(self, origSel_), class_getInstanceMethod(self, altSel_)); 64 | return YES; 65 | #else 66 | // Scan for non-inherited methods. 67 | Method directOriginalMethod = NULL, directAlternateMethod = NULL; 68 | 69 | void *iterator = NULL; 70 | struct objc_method_list *mlist = class_nextMethodList(self, &iterator); 71 | while (mlist) { 72 | int method_index = 0; 73 | for (; method_index < mlist->method_count; method_index++) { 74 | if (mlist->method_list[method_index].method_name == origSel_) { 75 | assert(!directOriginalMethod); 76 | directOriginalMethod = &mlist->method_list[method_index]; 77 | } 78 | if (mlist->method_list[method_index].method_name == altSel_) { 79 | assert(!directAlternateMethod); 80 | directAlternateMethod = &mlist->method_list[method_index]; 81 | } 82 | } 83 | mlist = class_nextMethodList(self, &iterator); 84 | } 85 | 86 | // If either method is inherited, copy it up to the target class to make it non-inherited. 87 | if (!directOriginalMethod || !directAlternateMethod) { 88 | Method inheritedOriginalMethod = NULL, inheritedAlternateMethod = NULL; 89 | if (!directOriginalMethod) { 90 | inheritedOriginalMethod = class_getInstanceMethod(self, origSel_); 91 | if (!inheritedOriginalMethod) { 92 | SetNSError(error_, @"original method %@ not found for class %@", NSStringFromSelector(origSel_), [self className]); 93 | return NO; 94 | } 95 | } 96 | if (!directAlternateMethod) { 97 | inheritedAlternateMethod = class_getInstanceMethod(self, altSel_); 98 | if (!inheritedAlternateMethod) { 99 | SetNSError(error_, @"alternate method %@ not found for class %@", NSStringFromSelector(altSel_), [self className]); 100 | return NO; 101 | } 102 | } 103 | 104 | int hoisted_method_count = !directOriginalMethod && !directAlternateMethod ? 2 : 1; 105 | struct objc_method_list *hoisted_method_list = malloc(sizeof(struct objc_method_list) + (sizeof(struct objc_method)*(hoisted_method_count-1))); 106 | hoisted_method_list->obsolete = NULL; // soothe valgrind - apparently ObjC runtime accesses this value and it shows as uninitialized in valgrind 107 | hoisted_method_list->method_count = hoisted_method_count; 108 | Method hoisted_method = hoisted_method_list->method_list; 109 | 110 | if (!directOriginalMethod) { 111 | bcopy(inheritedOriginalMethod, hoisted_method, sizeof(struct objc_method)); 112 | directOriginalMethod = hoisted_method++; 113 | } 114 | if (!directAlternateMethod) { 115 | bcopy(inheritedAlternateMethod, hoisted_method, sizeof(struct objc_method)); 116 | directAlternateMethod = hoisted_method; 117 | } 118 | class_addMethods(self, hoisted_method_list); 119 | } 120 | 121 | // Swizzle. 122 | IMP temp = directOriginalMethod->method_imp; 123 | directOriginalMethod->method_imp = directAlternateMethod->method_imp; 124 | directAlternateMethod->method_imp = temp; 125 | 126 | return YES; 127 | #endif 128 | } 129 | 130 | + (BOOL)jr_swizzleClassMethod:(SEL)origSel_ withClassMethod:(SEL)altSel_ error:(NSError**)error_ { 131 | return [GetClass((id)self) jr_swizzleMethod:origSel_ withMethod:altSel_ error:error_]; 132 | } 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain/JRSwizzle_license.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2007-2015 Jonathan 'Wolf' Rentzsch 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 13 | all 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 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain/MakeTheMacGreatAgain.h: -------------------------------------------------------------------------------- 1 | // 2 | // MakeTheMacGreatAgain.h 3 | // MakeTheMacGreatAgain 4 | // 5 | // Created by Craig Edwards on 15/04/2016. 6 | // Copyright © 2016 BlackDog Foundry Pty Ltd. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class MakeTheMacGreatAgain; 12 | 13 | static MakeTheMacGreatAgain *sharedPlugin; 14 | 15 | @interface MakeTheMacGreatAgain : NSObject 16 | 17 | + (instancetype)sharedPlugin; 18 | - (id)initWithBundle:(NSBundle *)plugin; 19 | 20 | @property (nonatomic, strong, readonly) NSBundle* bundle; 21 | @end -------------------------------------------------------------------------------- /MakeTheMacGreatAgain/MakeTheMacGreatAgain.m: -------------------------------------------------------------------------------- 1 | // 2 | // MakeTheMacGreatAgain.m 3 | // MakeTheMacGreatAgain 4 | // 5 | // Created by Craig Edwards on 15/04/2016. 6 | // Copyright © 2016 BlackDog Foundry Pty Ltd. All rights reserved. 7 | // 8 | 9 | #import "MakeTheMacGreatAgain.h" 10 | #import "JRSwizzle.h" 11 | 12 | @interface IDETemplateInstantiationContext 13 | -(NSArray *)arrayBySortingSections:(NSArray *)sections; 14 | @end 15 | @interface IDETemplateSection 16 | -(NSString *)navigableItem_name; 17 | @end 18 | 19 | @implementation NSObject (SwizzledMethods) 20 | 21 | /** 22 | * All this method does is take the sections that Xcode has sorted, and 23 | * then re-order them so that the OS X section is first. 24 | */ 25 | -(NSArray *)mtmga_arrayBySortingSections:(NSArray *)sections { 26 | // ask Xcode to sort using the original swizzled method 27 | NSArray *xCodeSortedSections = [self mtmga_arrayBySortingSections:sections]; 28 | 29 | // now pull out the "OS X" section and it to our new list 30 | NSMutableArray *macsAreGreatSections = [NSMutableArray array]; 31 | for (IDETemplateSection *section in xCodeSortedSections) { 32 | if ([[section navigableItem_name] isEqualToString:@"OS X"]) { 33 | [macsAreGreatSections addObject:section]; 34 | } 35 | } 36 | // now add the rest of them... 37 | for (IDETemplateSection *section in xCodeSortedSections) { 38 | if (![[section navigableItem_name] isEqualToString:@"OS X"]) { 39 | [macsAreGreatSections addObject:section]; 40 | } 41 | } 42 | return macsAreGreatSections; 43 | } 44 | 45 | @end 46 | 47 | @implementation MakeTheMacGreatAgain 48 | 49 | +(instancetype)sharedPlugin { 50 | return sharedPlugin; 51 | } 52 | 53 | -(id)initWithBundle:(NSBundle *)plugin { 54 | if (self = [super init]) { 55 | NSError *error = nil; 56 | Class clazz = NSClassFromString(@"IDETemplateInstantiationContext"); 57 | if (![clazz jr_swizzleMethod:@selector(arrayBySortingSections:) withMethod:@selector(mtmga_arrayBySortingSections:) error:&error]) { 58 | NSLog(@"Unable to swizzle sort method: %@", error); 59 | } 60 | } 61 | return self; 62 | } 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain/NSObject_Extension.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject_Extension.h 3 | // MakeTheMacGreatAgain 4 | // 5 | // Created by Craig Edwards on 15/04/2016. 6 | // Copyright © 2016 BlackDog Foundry Pty Ltd. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSObject (Xcode_Plugin_Template_Extension) 12 | 13 | + (void)pluginDidLoad:(NSBundle *)plugin; 14 | 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain/NSObject_Extension.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject_Extension.m 3 | // MakeTheMacGreatAgain 4 | // 5 | // Created by Craig Edwards on 15/04/2016. 6 | // Copyright © 2016 BlackDog Foundry Pty Ltd. All rights reserved. 7 | // 8 | 9 | 10 | #import "NSObject_Extension.h" 11 | #import "MakeTheMacGreatAgain.h" 12 | 13 | @implementation NSObject (Xcode_Plugin_Template_Extension) 14 | 15 | + (void)pluginDidLoad:(NSBundle *)plugin 16 | { 17 | static dispatch_once_t onceToken; 18 | NSString *currentApplicationName = [[NSBundle mainBundle] infoDictionary][@"CFBundleName"]; 19 | if ([currentApplicationName isEqual:@"Xcode"]) { 20 | dispatch_once(&onceToken, ^{ 21 | sharedPlugin = [[MakeTheMacGreatAgain alloc] initWithBundle:plugin]; 22 | }); 23 | } 24 | } 25 | @end 26 | -------------------------------------------------------------------------------- /MakeTheMacGreatAgain/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/edwardaux/MakeTheMacGreatAgain/b5d83a27d0e0664a198b2132bcdd01986123da95/MakeTheMacGreatAgain/screenshot.png -------------------------------------------------------------------------------- /license.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Craig Edwards. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 4 | associated documentation files (the "Software"), to deal in the Software without restriction, including 5 | without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 6 | copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 7 | following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or substantial 10 | portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 13 | LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 14 | NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 15 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 16 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 17 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## Apologies 2 | When I first created this plugin, the phrase "Make XXX Great Again" was a newly formed trope and, at the time, I was unable to foresee what it would come to represent. Knowing what I know now, I genuinely regret choosing this name and, in some small way, implicitly supporting this phrase and everything it has come to represent. I plan on renaming this plugin as soon as practical. 3 | 4 | ## Make The Mac Great Again 5 | This is a simple Xcode plugin that always make sure that the OS X templates are at the top of the list 6 | when creating new files or projects. 7 | 8 | 9 | 10 | ### License 11 | Released under the MIT license. 12 | --------------------------------------------------------------------------------