├── .gitignore ├── CleanClosureSyntax.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── CleanClosureSyntax ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ └── Main.storyboard ├── Info.plist └── ViewController.swift ├── Cleaner ├── Cleaner.entitlements ├── Info.plist ├── SourceEditorCommand.swift └── SourceEditorExtension.swift ├── LICENSE ├── README.md └── result.gif /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xcuserstate 23 | 24 | ## Obj-C/Swift specific 25 | *.hmap 26 | *.ipa 27 | *.dSYM.zip 28 | *.dSYM 29 | 30 | ## Playgrounds 31 | timeline.xctimeline 32 | playground.xcworkspace 33 | 34 | # Swift Package Manager 35 | # 36 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 37 | # Packages/ 38 | .build/ 39 | 40 | # CocoaPods 41 | # 42 | # We recommend against adding the Pods directory to your .gitignore. However 43 | # you should judge for yourself, the pros and cons are mentioned at: 44 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 45 | # 46 | # Pods/ 47 | 48 | # Carthage 49 | # 50 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 51 | # Carthage/Checkouts 52 | 53 | Carthage/Build 54 | 55 | # fastlane 56 | # 57 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 58 | # screenshots whenever they are needed. 59 | # For more information about the recommended setup visit: 60 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md 61 | 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | -------------------------------------------------------------------------------- /CleanClosureSyntax.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | AE2862D61D25568D00219753 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2862D51D25568D00219753 /* AppDelegate.swift */; }; 11 | AE2862D81D25568D00219753 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2862D71D25568D00219753 /* ViewController.swift */; }; 12 | AE2862DA1D25568D00219753 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AE2862D91D25568D00219753 /* Assets.xcassets */; }; 13 | AE2862DD1D25568D00219753 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AE2862DB1D25568D00219753 /* Main.storyboard */; }; 14 | AE2862EB1D2556DE00219753 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE2862EA1D2556DE00219753 /* Cocoa.framework */; }; 15 | AE2862F01D2556DE00219753 /* SourceEditorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2862EF1D2556DE00219753 /* SourceEditorExtension.swift */; }; 16 | AE2862F21D2556DE00219753 /* SourceEditorCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE2862F11D2556DE00219753 /* SourceEditorCommand.swift */; }; 17 | AE2862F61D2556DE00219753 /* Cleaner.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = AE2862E81D2556DE00219753 /* Cleaner.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | AE2862F41D2556DE00219753 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = AE2862CA1D25568D00219753 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = AE2862E71D2556DE00219753; 26 | remoteInfo = Cleaner; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXCopyFilesBuildPhase section */ 31 | AE2862FA1D2556DE00219753 /* Embed App Extensions */ = { 32 | isa = PBXCopyFilesBuildPhase; 33 | buildActionMask = 2147483647; 34 | dstPath = ""; 35 | dstSubfolderSpec = 13; 36 | files = ( 37 | AE2862F61D2556DE00219753 /* Cleaner.appex in Embed App Extensions */, 38 | ); 39 | name = "Embed App Extensions"; 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXCopyFilesBuildPhase section */ 43 | 44 | /* Begin PBXFileReference section */ 45 | AE2862D21D25568D00219753 /* CleanClosureSyntax.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CleanClosureSyntax.app; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | AE2862D51D25568D00219753 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 47 | AE2862D71D25568D00219753 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 48 | AE2862D91D25568D00219753 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 49 | AE2862DC1D25568D00219753 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | AE2862DE1D25568D00219753 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | AE2862E81D2556DE00219753 /* Cleaner.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Cleaner.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | AE2862EA1D2556DE00219753 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 53 | AE2862EE1D2556DE00219753 /* Cleaner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = Cleaner.entitlements; sourceTree = ""; }; 54 | AE2862EF1D2556DE00219753 /* SourceEditorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceEditorExtension.swift; sourceTree = ""; }; 55 | AE2862F11D2556DE00219753 /* SourceEditorCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceEditorCommand.swift; sourceTree = ""; }; 56 | AE2862F31D2556DE00219753 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | AE2862CF1D25568D00219753 /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | AE2862E51D2556DE00219753 /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | AE2862EB1D2556DE00219753 /* Cocoa.framework in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | /* End PBXFrameworksBuildPhase section */ 76 | 77 | /* Begin PBXGroup section */ 78 | AE2862C91D25568D00219753 = { 79 | isa = PBXGroup; 80 | children = ( 81 | AE2862D41D25568D00219753 /* CleanClosureSyntax */, 82 | AE2862EC1D2556DE00219753 /* Cleaner */, 83 | AE2862E91D2556DE00219753 /* Frameworks */, 84 | AE2862D31D25568D00219753 /* Products */, 85 | ); 86 | sourceTree = ""; 87 | }; 88 | AE2862D31D25568D00219753 /* Products */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | AE2862D21D25568D00219753 /* CleanClosureSyntax.app */, 92 | AE2862E81D2556DE00219753 /* Cleaner.appex */, 93 | ); 94 | name = Products; 95 | sourceTree = ""; 96 | }; 97 | AE2862D41D25568D00219753 /* CleanClosureSyntax */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | AE2862D51D25568D00219753 /* AppDelegate.swift */, 101 | AE2862D71D25568D00219753 /* ViewController.swift */, 102 | AE2862D91D25568D00219753 /* Assets.xcassets */, 103 | AE2862DB1D25568D00219753 /* Main.storyboard */, 104 | AE2862DE1D25568D00219753 /* Info.plist */, 105 | ); 106 | path = CleanClosureSyntax; 107 | sourceTree = ""; 108 | }; 109 | AE2862E91D2556DE00219753 /* Frameworks */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | AE2862EA1D2556DE00219753 /* Cocoa.framework */, 113 | ); 114 | name = Frameworks; 115 | sourceTree = ""; 116 | }; 117 | AE2862EC1D2556DE00219753 /* Cleaner */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | AE2862EF1D2556DE00219753 /* SourceEditorExtension.swift */, 121 | AE2862F11D2556DE00219753 /* SourceEditorCommand.swift */, 122 | AE2862F31D2556DE00219753 /* Info.plist */, 123 | AE2862ED1D2556DE00219753 /* Supporting Files */, 124 | ); 125 | path = Cleaner; 126 | sourceTree = ""; 127 | }; 128 | AE2862ED1D2556DE00219753 /* Supporting Files */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | AE2862EE1D2556DE00219753 /* Cleaner.entitlements */, 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | /* End PBXGroup section */ 137 | 138 | /* Begin PBXNativeTarget section */ 139 | AE2862D11D25568D00219753 /* CleanClosureSyntax */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = AE2862E11D25568D00219753 /* Build configuration list for PBXNativeTarget "CleanClosureSyntax" */; 142 | buildPhases = ( 143 | AE2862CE1D25568D00219753 /* Sources */, 144 | AE2862CF1D25568D00219753 /* Frameworks */, 145 | AE2862D01D25568D00219753 /* Resources */, 146 | AE2862FA1D2556DE00219753 /* Embed App Extensions */, 147 | ); 148 | buildRules = ( 149 | ); 150 | dependencies = ( 151 | AE2862F51D2556DE00219753 /* PBXTargetDependency */, 152 | ); 153 | name = CleanClosureSyntax; 154 | productName = CleanClosureSyntax; 155 | productReference = AE2862D21D25568D00219753 /* CleanClosureSyntax.app */; 156 | productType = "com.apple.product-type.application"; 157 | }; 158 | AE2862E71D2556DE00219753 /* Cleaner */ = { 159 | isa = PBXNativeTarget; 160 | buildConfigurationList = AE2862F71D2556DE00219753 /* Build configuration list for PBXNativeTarget "Cleaner" */; 161 | buildPhases = ( 162 | AE2862E41D2556DE00219753 /* Sources */, 163 | AE2862E51D2556DE00219753 /* Frameworks */, 164 | AE2862E61D2556DE00219753 /* Resources */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | ); 170 | name = Cleaner; 171 | productName = Cleaner; 172 | productReference = AE2862E81D2556DE00219753 /* Cleaner.appex */; 173 | productType = "com.apple.product-type.xcode-extension"; 174 | }; 175 | /* End PBXNativeTarget section */ 176 | 177 | /* Begin PBXProject section */ 178 | AE2862CA1D25568D00219753 /* Project object */ = { 179 | isa = PBXProject; 180 | attributes = { 181 | LastSwiftUpdateCheck = 0800; 182 | LastUpgradeCheck = 0920; 183 | ORGANIZATIONNAME = "Patrick Balestra"; 184 | TargetAttributes = { 185 | AE2862D11D25568D00219753 = { 186 | CreatedOnToolsVersion = 8.0; 187 | DevelopmentTeam = ENLH686A45; 188 | DevelopmentTeamName = "Patrick Balestra"; 189 | ProvisioningStyle = Automatic; 190 | }; 191 | AE2862E71D2556DE00219753 = { 192 | CreatedOnToolsVersion = 8.0; 193 | DevelopmentTeam = ENLH686A45; 194 | DevelopmentTeamName = "Patrick Balestra"; 195 | ProvisioningStyle = Automatic; 196 | }; 197 | }; 198 | }; 199 | buildConfigurationList = AE2862CD1D25568D00219753 /* Build configuration list for PBXProject "CleanClosureSyntax" */; 200 | compatibilityVersion = "Xcode 3.2"; 201 | developmentRegion = English; 202 | hasScannedForEncodings = 0; 203 | knownRegions = ( 204 | en, 205 | Base, 206 | ); 207 | mainGroup = AE2862C91D25568D00219753; 208 | productRefGroup = AE2862D31D25568D00219753 /* Products */; 209 | projectDirPath = ""; 210 | projectRoot = ""; 211 | targets = ( 212 | AE2862D11D25568D00219753 /* CleanClosureSyntax */, 213 | AE2862E71D2556DE00219753 /* Cleaner */, 214 | ); 215 | }; 216 | /* End PBXProject section */ 217 | 218 | /* Begin PBXResourcesBuildPhase section */ 219 | AE2862D01D25568D00219753 /* Resources */ = { 220 | isa = PBXResourcesBuildPhase; 221 | buildActionMask = 2147483647; 222 | files = ( 223 | AE2862DA1D25568D00219753 /* Assets.xcassets in Resources */, 224 | AE2862DD1D25568D00219753 /* Main.storyboard in Resources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | AE2862E61D2556DE00219753 /* Resources */ = { 229 | isa = PBXResourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | }; 235 | /* End PBXResourcesBuildPhase section */ 236 | 237 | /* Begin PBXSourcesBuildPhase section */ 238 | AE2862CE1D25568D00219753 /* Sources */ = { 239 | isa = PBXSourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | AE2862D81D25568D00219753 /* ViewController.swift in Sources */, 243 | AE2862D61D25568D00219753 /* AppDelegate.swift in Sources */, 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | AE2862E41D2556DE00219753 /* Sources */ = { 248 | isa = PBXSourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | AE2862F01D2556DE00219753 /* SourceEditorExtension.swift in Sources */, 252 | AE2862F21D2556DE00219753 /* SourceEditorCommand.swift in Sources */, 253 | ); 254 | runOnlyForDeploymentPostprocessing = 0; 255 | }; 256 | /* End PBXSourcesBuildPhase section */ 257 | 258 | /* Begin PBXTargetDependency section */ 259 | AE2862F51D2556DE00219753 /* PBXTargetDependency */ = { 260 | isa = PBXTargetDependency; 261 | target = AE2862E71D2556DE00219753 /* Cleaner */; 262 | targetProxy = AE2862F41D2556DE00219753 /* PBXContainerItemProxy */; 263 | }; 264 | /* End PBXTargetDependency section */ 265 | 266 | /* Begin PBXVariantGroup section */ 267 | AE2862DB1D25568D00219753 /* Main.storyboard */ = { 268 | isa = PBXVariantGroup; 269 | children = ( 270 | AE2862DC1D25568D00219753 /* Base */, 271 | ); 272 | name = Main.storyboard; 273 | sourceTree = ""; 274 | }; 275 | /* End PBXVariantGroup section */ 276 | 277 | /* Begin XCBuildConfiguration section */ 278 | AE2862DF1D25568D00219753 /* Debug */ = { 279 | isa = XCBuildConfiguration; 280 | buildSettings = { 281 | ALWAYS_SEARCH_USER_PATHS = NO; 282 | CLANG_ANALYZER_NONNULL = YES; 283 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 284 | CLANG_CXX_LIBRARY = "libc++"; 285 | CLANG_ENABLE_MODULES = YES; 286 | CLANG_ENABLE_OBJC_ARC = YES; 287 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_COMMA = YES; 290 | CLANG_WARN_CONSTANT_CONVERSION = YES; 291 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 292 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 293 | CLANG_WARN_EMPTY_BODY = YES; 294 | CLANG_WARN_ENUM_CONVERSION = YES; 295 | CLANG_WARN_INFINITE_RECURSION = YES; 296 | CLANG_WARN_INT_CONVERSION = YES; 297 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 298 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 299 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 300 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 301 | CLANG_WARN_STRICT_PROTOTYPES = YES; 302 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 303 | CLANG_WARN_UNREACHABLE_CODE = YES; 304 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 305 | CODE_SIGN_IDENTITY = "-"; 306 | COPY_PHASE_STRIP = NO; 307 | DEBUG_INFORMATION_FORMAT = dwarf; 308 | ENABLE_STRICT_OBJC_MSGSEND = YES; 309 | ENABLE_TESTABILITY = YES; 310 | GCC_C_LANGUAGE_STANDARD = gnu99; 311 | GCC_DYNAMIC_NO_PIC = NO; 312 | GCC_NO_COMMON_BLOCKS = YES; 313 | GCC_OPTIMIZATION_LEVEL = 0; 314 | GCC_PREPROCESSOR_DEFINITIONS = ( 315 | "DEBUG=1", 316 | "$(inherited)", 317 | ); 318 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 319 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 320 | GCC_WARN_UNDECLARED_SELECTOR = YES; 321 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 322 | GCC_WARN_UNUSED_FUNCTION = YES; 323 | GCC_WARN_UNUSED_VARIABLE = YES; 324 | MACOSX_DEPLOYMENT_TARGET = 10.11; 325 | MTL_ENABLE_DEBUG_INFO = YES; 326 | ONLY_ACTIVE_ARCH = YES; 327 | SDKROOT = macosx; 328 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 329 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 330 | }; 331 | name = Debug; 332 | }; 333 | AE2862E01D25568D00219753 /* Release */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 356 | CLANG_WARN_STRICT_PROTOTYPES = YES; 357 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 358 | CLANG_WARN_UNREACHABLE_CODE = YES; 359 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 360 | CODE_SIGN_IDENTITY = "-"; 361 | COPY_PHASE_STRIP = NO; 362 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 363 | ENABLE_NS_ASSERTIONS = NO; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 368 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 369 | GCC_WARN_UNDECLARED_SELECTOR = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 371 | GCC_WARN_UNUSED_FUNCTION = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | MACOSX_DEPLOYMENT_TARGET = 10.11; 374 | MTL_ENABLE_DEBUG_INFO = NO; 375 | SDKROOT = macosx; 376 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 377 | }; 378 | name = Release; 379 | }; 380 | AE2862E21D25568D00219753 /* Debug */ = { 381 | isa = XCBuildConfiguration; 382 | buildSettings = { 383 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 384 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 385 | CODE_SIGN_IDENTITY = "Mac Developer"; 386 | COMBINE_HIDPI_IMAGES = YES; 387 | DEVELOPMENT_TEAM = ENLH686A45; 388 | INFOPLIST_FILE = CleanClosureSyntax/Info.plist; 389 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 390 | PRODUCT_BUNDLE_IDENTIFIER = com.patrickbalestra.CleanClosureSyntax; 391 | PRODUCT_NAME = "$(TARGET_NAME)"; 392 | SWIFT_VERSION = 4.0; 393 | }; 394 | name = Debug; 395 | }; 396 | AE2862E31D25568D00219753 /* Release */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 400 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 401 | CODE_SIGN_IDENTITY = "Mac Developer"; 402 | COMBINE_HIDPI_IMAGES = YES; 403 | DEVELOPMENT_TEAM = ENLH686A45; 404 | INFOPLIST_FILE = CleanClosureSyntax/Info.plist; 405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 406 | PRODUCT_BUNDLE_IDENTIFIER = com.patrickbalestra.CleanClosureSyntax; 407 | PRODUCT_NAME = "$(TARGET_NAME)"; 408 | SWIFT_VERSION = 4.0; 409 | }; 410 | name = Release; 411 | }; 412 | AE2862F81D2556DE00219753 /* Debug */ = { 413 | isa = XCBuildConfiguration; 414 | buildSettings = { 415 | CODE_SIGN_ENTITLEMENTS = Cleaner/Cleaner.entitlements; 416 | CODE_SIGN_IDENTITY = "Mac Developer"; 417 | COMBINE_HIDPI_IMAGES = YES; 418 | DEVELOPMENT_TEAM = ENLH686A45; 419 | INFOPLIST_FILE = Cleaner/Info.plist; 420 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks"; 421 | MACOSX_DEPLOYMENT_TARGET = 10.11; 422 | PRODUCT_BUNDLE_IDENTIFIER = com.patrickbalestra.CleanClosureSyntax.Cleaner; 423 | PRODUCT_NAME = "$(TARGET_NAME)"; 424 | SKIP_INSTALL = YES; 425 | SWIFT_VERSION = 4.0; 426 | }; 427 | name = Debug; 428 | }; 429 | AE2862F91D2556DE00219753 /* Release */ = { 430 | isa = XCBuildConfiguration; 431 | buildSettings = { 432 | CODE_SIGN_ENTITLEMENTS = Cleaner/Cleaner.entitlements; 433 | CODE_SIGN_IDENTITY = "Mac Developer"; 434 | COMBINE_HIDPI_IMAGES = YES; 435 | DEVELOPMENT_TEAM = ENLH686A45; 436 | INFOPLIST_FILE = Cleaner/Info.plist; 437 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks"; 438 | MACOSX_DEPLOYMENT_TARGET = 10.11; 439 | PRODUCT_BUNDLE_IDENTIFIER = com.patrickbalestra.CleanClosureSyntax.Cleaner; 440 | PRODUCT_NAME = "$(TARGET_NAME)"; 441 | SKIP_INSTALL = YES; 442 | SWIFT_VERSION = 4.0; 443 | }; 444 | name = Release; 445 | }; 446 | /* End XCBuildConfiguration section */ 447 | 448 | /* Begin XCConfigurationList section */ 449 | AE2862CD1D25568D00219753 /* Build configuration list for PBXProject "CleanClosureSyntax" */ = { 450 | isa = XCConfigurationList; 451 | buildConfigurations = ( 452 | AE2862DF1D25568D00219753 /* Debug */, 453 | AE2862E01D25568D00219753 /* Release */, 454 | ); 455 | defaultConfigurationIsVisible = 0; 456 | defaultConfigurationName = Release; 457 | }; 458 | AE2862E11D25568D00219753 /* Build configuration list for PBXNativeTarget "CleanClosureSyntax" */ = { 459 | isa = XCConfigurationList; 460 | buildConfigurations = ( 461 | AE2862E21D25568D00219753 /* Debug */, 462 | AE2862E31D25568D00219753 /* Release */, 463 | ); 464 | defaultConfigurationIsVisible = 0; 465 | defaultConfigurationName = Release; 466 | }; 467 | AE2862F71D2556DE00219753 /* Build configuration list for PBXNativeTarget "Cleaner" */ = { 468 | isa = XCConfigurationList; 469 | buildConfigurations = ( 470 | AE2862F81D2556DE00219753 /* Debug */, 471 | AE2862F91D2556DE00219753 /* Release */, 472 | ); 473 | defaultConfigurationIsVisible = 0; 474 | defaultConfigurationName = Release; 475 | }; 476 | /* End XCConfigurationList section */ 477 | }; 478 | rootObject = AE2862CA1D25568D00219753 /* Project object */; 479 | } 480 | -------------------------------------------------------------------------------- /CleanClosureSyntax.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CleanClosureSyntax/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CleanClosureSyntax 4 | // 5 | // Created by Patrick Balestra on 6/30/16. 6 | // Copyright © 2016 Patrick Balestra. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | 15 | 16 | func applicationDidFinishLaunching(_ aNotification: Notification) { 17 | // Insert code here to initialize your application 18 | } 19 | 20 | func applicationWillTerminate(_ aNotification: Notification) { 21 | // Insert code here to tear down your application 22 | } 23 | 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /CleanClosureSyntax/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /CleanClosureSyntax/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 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 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | Default 509 | 510 | 511 | 512 | 513 | 514 | 515 | Left to Right 516 | 517 | 518 | 519 | 520 | 521 | 522 | Right to Left 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | Default 534 | 535 | 536 | 537 | 538 | 539 | 540 | Left to Right 541 | 542 | 543 | 544 | 545 | 546 | 547 | Right to Left 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | -------------------------------------------------------------------------------- /CleanClosureSyntax/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 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 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2016 Patrick Balestra. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /CleanClosureSyntax/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CleanClosureSyntax 4 | // 5 | // Created by Patrick Balestra on 6/30/16. 6 | // Copyright © 2016 Patrick Balestra. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class ViewController: NSViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | // Do any additional setup after loading the view. 17 | } 18 | 19 | override var representedObject: Any? { 20 | didSet { 21 | // Update the view, if already loaded. 22 | } 23 | } 24 | 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Cleaner/Cleaner.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Cleaner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | Cleaner 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | XPC! 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSExtension 28 | 29 | NSExtensionAttributes 30 | 31 | XCSourceEditorCommandDefinitions 32 | 33 | 34 | XCSourceEditorCommandClassName 35 | $(PRODUCT_MODULE_NAME).SourceEditorCommand 36 | XCSourceEditorCommandIdentifier 37 | com.patrickbalestra.CleanClosureSyntax.Cleaner.SourceEditorCommand 38 | XCSourceEditorCommandName 39 | Clean Syntax 40 | 41 | 42 | XCSourceEditorExtensionPrincipalClass 43 | $(PRODUCT_MODULE_NAME).SourceEditorExtension 44 | 45 | NSExtensionPointIdentifier 46 | com.apple.dt.Xcode.extension.source-editor 47 | 48 | NSHumanReadableCopyright 49 | Copyright © 2016 Patrick Balestra. All rights reserved. 50 | 51 | 52 | -------------------------------------------------------------------------------- /Cleaner/SourceEditorCommand.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceEditorCommand.swift 3 | // Cleaner 4 | // 5 | // Created by Patrick Balestra on 6/30/16. 6 | // Copyright © 2016 Patrick Balestra. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import XcodeKit 11 | 12 | extension String { 13 | // Remove the given characters in the range 14 | func remove(characters: [Character], in range: NSRange) -> String { 15 | var cleanString = self 16 | for char in characters { 17 | cleanString = cleanString.replacingOccurrences(of: String(char), with: "", options: [.caseInsensitive], range: cleanString.range(from: range)) as String 18 | } 19 | return cleanString 20 | } 21 | 22 | //change NSRange to Range 23 | func range(from nsRange: NSRange) -> Range? { 24 | guard 25 | let from16 = utf16.index(utf16.startIndex, offsetBy: nsRange.location, 26 | limitedBy: utf16.endIndex), 27 | let to16 = utf16.index(from16, offsetBy: nsRange.length, 28 | limitedBy: utf16.endIndex), 29 | let from = String.Index(from16, within: self), 30 | let to = String.Index(to16, within: self) 31 | else { return nil } 32 | return from ..< to 33 | } 34 | } 35 | 36 | class SourceEditorCommand: NSObject, XCSourceEditorCommand { 37 | 38 | func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void ) -> Void { 39 | var updatedLineIndexes = [Int]() 40 | 41 | // Find lines that contain a closure syntax 42 | for lineIndex in 0 ..< invocation.buffer.lines.count { 43 | let line = invocation.buffer.lines[lineIndex] as! String 44 | do { 45 | let regex = try NSRegularExpression(pattern: "\\{.*\\(.+\\).+in", options: .caseInsensitive) 46 | let range = NSRange(0 ..< line.count) 47 | let results = regex.matches(in: line as String, options: .reportProgress, range: range) 48 | // When a closure is found, clean up its syntax 49 | _ = results.map { result in 50 | let cleanLine = line.remove(characters: ["(", ")"], in: result.range) 51 | updatedLineIndexes.append(lineIndex) 52 | invocation.buffer.lines[lineIndex] = cleanLine 53 | } 54 | } catch { 55 | completionHandler(error as Error) 56 | } 57 | } 58 | 59 | // If at least a line was changed, create an array of changes and pass it to the buffer selections 60 | if !updatedLineIndexes.isEmpty { 61 | let updatedSelections: [XCSourceTextRange] = updatedLineIndexes.map { lineIndex in 62 | let lineSelection = XCSourceTextRange() 63 | lineSelection.start = XCSourceTextPosition(line: lineIndex, column: 0) 64 | lineSelection.end = XCSourceTextPosition(line: lineIndex, column: 0) 65 | return lineSelection 66 | } 67 | invocation.buffer.selections.setArray(updatedSelections) 68 | } 69 | completionHandler(nil) 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Cleaner/SourceEditorExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceEditorExtension.swift 3 | // Cleaner 4 | // 5 | // Created by Patrick Balestra on 6/30/16. 6 | // Copyright © 2016 Patrick Balestra. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import XcodeKit 11 | 12 | class SourceEditorExtension: NSObject, XCSourceEditorExtension { 13 | 14 | /* 15 | func extensionDidFinishLaunching() { 16 | // If your extension needs to do any work at launch, implement this optional method. 17 | } 18 | */ 19 | 20 | /* 21 | var commandDefinitions: [[XCSourceEditorCommandDefinitionKey: AnyObject]] { 22 | // If your extension needs to return a collection of command definitions that differs from those in its Info.plist, implement this optional property getter. 23 | return [] 24 | } 25 | */ 26 | 27 | } 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Patrick Balestra 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Clean Closure - Xcode Source Editor Extension 2 | 3 |

4 | 5 | 6 | Clean Closure is a simple Xcode Source Editor Extension for Xcode 8. It parses each line of a file to simplify the syntax of closures in your Swift code by removing the useless `()`. 7 | 8 | The code is pretty straighforward and it uses a `NSRegularExpression` to find out where a closure is by looking for `(`, `)` and `in` characters. 9 | 10 | ## Requirements 11 | 🛠 Xcode 8.0 and Swift 3.0. 12 | 13 | Please run `sudo /usr/libexec/xpccachectl` and restart your Mac before running the extension if you are on macOS 10.11 El Capitan. 14 | 15 | ## Author 16 | 17 | I'm [Patrick Balestra](http://www.patrickbalestra.com). 18 | Email: [me@patrickbalestra.com](mailto:me@patrickbalestra.com) 19 | Twitter: [@BalestraPatrick](http://twitter.com/BalestraPatrick). 20 | 21 | ## License 22 | 23 | `CleanClosureXcode` is available under the MIT license. See the [LICENSE](LICENSE) file for more info. -------------------------------------------------------------------------------- /result.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BalestraPatrick/CleanClosureXcode/f350cb5fcda9c7a1f1f563501f5f46c6dfaf498a/result.gif --------------------------------------------------------------------------------