├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── SwiftLint ├── Info.plist ├── SourceEditorCommand.swift ├── SourceEditorExtension.swift ├── SwiftLint-Bridging-Header.h └── SwiftLint.entitlements ├── SwiftLintForXcode.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ ├── SwiftLint.xcscheme │ ├── SwiftLintForXcode.xcscheme │ └── SwiftLintHelper.xcscheme ├── SwiftLintForXcode ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ └── MainMenu.xib └── Info.plist └── SwiftLintHelper ├── Info.plist ├── SwiftLintHelper-Bridging-Header.h ├── SwiftLintHelper.swift ├── SwiftLintHelperProtocol.h └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/* 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | *.xcworkspace 15 | !default.xcworkspace 16 | xcuserdata 17 | profile 18 | *.moved-aside 19 | 20 | # 21 | headers 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: generic 2 | os: osx 3 | osx_image: xcode9.1 4 | script: xcodebuild -scheme SwiftLintForXcode install DSTROOT=~ CODE_SIGN_IDENTITY="" 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Norio Nomura 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SwiftLint for Xcode 2 | [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE) 3 | 4 | SwiftLint for Xcode is a Xcode Extension that was created to run [SwiftLint](https://github.com/realm/SwiftLint). 5 | 6 | ## Requirements 7 | - Xcode 9.1 8 | - [SwiftLint](https://github.com/realm/SwiftLint) 9 | 10 | ## Install 11 | 12 | 1. Install Xcode 9.1 13 | 2. If you are using OS X 10.11, running `sudo /usr/libexec/xpccachectl` and rebooting are required for using Xcode Extension. 14 | 3. Clone this repository. 15 | 4. Open `SwiftLintForXcode.xcodeproj` double clicking on it. 16 | 5. Configure signing with your own developer ID on all three targets (SwiftLintForXcode, SwiftLint and SwiftLintHelper). 17 | 6. Quit Xcode. 18 | 7. Open a terminal, change to the directory where you cloned and run `xcodebuild -scheme SwiftLintForXcode install DSTROOT=~` to compile the extension. 19 | 8. Run `~/Applications/SwiftLintForXcode.app` and quit. 20 | 9. Go to System Preferences -> Extensions -> Xcode Source Editor and enable the extension. 21 | 10. Open Xcode and the extension should be found in Editor -> SwiftLint. 22 | 23 | ## Author 24 | 25 | Norio Nomura 26 | 27 | ## License 28 | 29 | SwiftLint for Xcode is available under the MIT license. See the [LICENSE](LICENSE) file for more info. 30 | -------------------------------------------------------------------------------- /SwiftLint/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | SwiftLint 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 | 0.1 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 | io.github.norio-nomura.SwiftLintForXcode.SwiftLint.autocorrect 38 | XCSourceEditorCommandName 39 | Run swiftlint autocorrect 40 | 41 | 42 | XCSourceEditorCommandClassName 43 | $(PRODUCT_MODULE_NAME).SourceEditorCommand 44 | XCSourceEditorCommandIdentifier 45 | io.github.norio-nomura.SwiftLintForXcode.SwiftLint.autocorrect-format 46 | XCSourceEditorCommandName 47 | Run swiftlint autocorrect --format 48 | 49 | 50 | XCSourceEditorExtensionPrincipalClass 51 | $(PRODUCT_MODULE_NAME).SourceEditorExtension 52 | 53 | NSExtensionPointIdentifier 54 | com.apple.dt.Xcode.extension.source-editor 55 | 56 | NSHumanReadableCopyright 57 | Copyright © 2016 Norio Nomura. All rights reserved. 58 | 59 | 60 | -------------------------------------------------------------------------------- /SwiftLint/SourceEditorCommand.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceEditorCommand.swift 3 | // SwiftLint 4 | // 5 | // Created by 野村 憲男 on 6/15/16. 6 | // 7 | // Copyright (c) 2016 Norio Nomura 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | import Foundation 29 | import XcodeKit 30 | 31 | let targetContentUTIs = ["public.swift-source", "com.apple.dt.playgroundpage"] 32 | 33 | class SourceEditorCommand: NSObject, XCSourceEditorCommand { 34 | 35 | func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Error?) -> Void ) -> Void { 36 | 37 | var error: Error? = nil 38 | defer { completionHandler(error) } 39 | 40 | if !targetContentUTIs.contains(invocation.buffer.contentUTI) { return } 41 | 42 | do { 43 | let fm = FileManager.default 44 | let temporaryDirectory = (NSTemporaryDirectory() as NSString) 45 | .appendingPathComponent("autocorrect") as NSString 46 | 47 | // create temporary directory 48 | if !fm.fileExists(atPath: temporaryDirectory as String) { 49 | try fm.createDirectory(atPath: temporaryDirectory as String, 50 | withIntermediateDirectories: true, attributes: nil) 51 | } 52 | 53 | // create empty .swiftlint.yml in temporary directory 54 | let config = temporaryDirectory.appendingPathComponent(".swiftlint.yml") 55 | if !fm.fileExists(atPath: config) { 56 | try "".write(toFile: config, atomically: true, encoding: .utf8) 57 | } 58 | 59 | // create temporary.swift in temporary directory 60 | let source = temporaryDirectory.appendingPathComponent("temporary.swift") 61 | try invocation.buffer.completeBuffer.write(toFile: source, atomically: true, encoding: .utf8) 62 | 63 | // run autocorrect 64 | switch invocation.commandIdentifier { 65 | case "io.github.norio-nomura.SwiftLintForXcode.SwiftLint.autocorrect": 66 | try autocorrect(directory: temporaryDirectory as String) 67 | case "io.github.norio-nomura.SwiftLintForXcode.SwiftLint.autocorrect-format": 68 | try autocorrect(directory: temporaryDirectory as String, arguments: ["--format"]) 69 | default: 70 | throw SwiftLintError.unknownCommandIdentifier 71 | } 72 | 73 | // check result 74 | if let autocorrected = try? String(contentsOfFile: source) as NSString 75 | , invocation.buffer.completeBuffer != autocorrected as String { 76 | 77 | // update lines 78 | var start = 0, end = 0, lineIndex = 0 79 | var updatedLines = [Int]() 80 | let originalLineCount = invocation.buffer.lines.count 81 | while start < autocorrected.length { 82 | let range = NSRange(location: start, length: 0) 83 | autocorrected.getLineStart(&start, end: &end, contentsEnd: nil, for: range) 84 | let lineRange = NSRange(location: start, length: end - start) 85 | let newLine = autocorrected.substring(with: lineRange) 86 | 87 | let originalLine = invocation.buffer.lines[lineIndex] as! NSString 88 | if originalLine as String != newLine { 89 | if lineIndex < originalLineCount { 90 | invocation.buffer.lines[lineIndex] = newLine 91 | } else { 92 | invocation.buffer.lines.add(newLine) 93 | } 94 | updatedLines.append(lineIndex) 95 | } 96 | lineIndex += 1 97 | start = end 98 | } 99 | if lineIndex <= originalLineCount { 100 | let indexSet = IndexSet(integersIn: lineIndex.. XCSourceTextRange in 106 | let range = XCSourceTextRange() 107 | range.start = XCSourceTextPosition(line: lineIndex, column: 0) 108 | range.end = XCSourceTextPosition(line: lineIndex + 1, column: 0) 109 | return range 110 | } 111 | if !updatedSelections.isEmpty { 112 | invocation.buffer.selections.setArray(updatedSelections) 113 | } 114 | } 115 | } catch let caughtError { 116 | print(caughtError) 117 | error = caughtError 118 | return 119 | } 120 | 121 | } 122 | 123 | deinit { 124 | connection.invalidate() 125 | } 126 | 127 | private let connection = { () -> NSXPCConnection in 128 | let connection = NSXPCConnection(serviceName: "io.github.norio-nomura.SwiftLintForXcode.SwiftLintHelper") 129 | connection.remoteObjectInterface = NSXPCInterface(with: SwiftLintHelperProtocol.self) 130 | return connection 131 | }() 132 | 133 | private enum SwiftLintError: Error, CustomNSError, CustomStringConvertible { 134 | case error(String) 135 | case helperConnectError 136 | case unknownCommandIdentifier 137 | 138 | // CustomNSError 139 | var errorUserInfo: [String : Any] { 140 | return [NSLocalizedDescriptionKey: description] 141 | } 142 | 143 | // CustomStringConvertible 144 | var description: String { 145 | switch self { 146 | case .error(let message): return "error: \(message)" 147 | case .helperConnectError: return "Helper Connectiont Error" 148 | case .unknownCommandIdentifier: return "Unknown Command Identifier" 149 | } 150 | } 151 | } 152 | 153 | typealias ReplyHandler = (Int, String, String) throws -> Void 154 | 155 | private func swiftlint(in directory: String, with arguments: [String], reply: ReplyHandler) throws { 156 | connection.resume() 157 | defer { connection.suspend() } 158 | guard let swiftlint = connection.remoteObjectProxy as? SwiftLintHelperProtocol else { 159 | print("Failt to connect: \(connection)") 160 | throw SwiftLintError.helperConnectError 161 | } 162 | let semaphore = DispatchSemaphore(value: 0) 163 | var (status, output, errorOutput) = (0, "", "") 164 | swiftlint.execute(in: directory, with: arguments) { 165 | (status, output, errorOutput) = ($0, $1, $2) 166 | semaphore.signal() 167 | } 168 | _ = semaphore.wait(timeout: .now() + 10) 169 | try reply(status, output, errorOutput) 170 | } 171 | 172 | private func autocorrect(directory: String, arguments: [String] = []) throws { 173 | try swiftlint(in: directory, with: ["autocorrect"] + arguments) { status, output, errorOutput in 174 | if status != 0 { 175 | throw SwiftLintError.error(errorOutput) 176 | } 177 | } 178 | } 179 | } 180 | -------------------------------------------------------------------------------- /SwiftLint/SourceEditorExtension.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SourceEditorExtension.swift 3 | // SwiftLint 4 | // 5 | // Created by 野村 憲男 on 6/15/16. 6 | // 7 | // Copyright (c) 2016 Norio Nomura 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | import Foundation 29 | import XcodeKit 30 | 31 | class SourceEditorExtension: NSObject, XCSourceEditorExtension { 32 | 33 | /* 34 | func extensionDidFinishLaunching() { 35 | // If your extension needs to do any work at launch, implement this optional method. 36 | } 37 | */ 38 | 39 | /* 40 | var commandDefinitions: [[XCSourceEditorCommandDefinitionKey: AnyObject]] { 41 | // If your extension needs to return a collection of command definitions that differs from those in its Info.plist, implement this optional property getter. 42 | return [] 43 | } 44 | */ 45 | 46 | } 47 | -------------------------------------------------------------------------------- /SwiftLint/SwiftLint-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "SwiftLintHelperProtocol.h" 6 | -------------------------------------------------------------------------------- /SwiftLint/SwiftLint.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftLintForXcode.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6C8200221D111C160053733B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C8200211D111C160053733B /* AppDelegate.swift */; }; 11 | 6C8200241D111C160053733B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6C8200231D111C160053733B /* Assets.xcassets */; }; 12 | 6C8200271D111C160053733B /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6C8200251D111C160053733B /* MainMenu.xib */; }; 13 | 6C8200351D111C5B0053733B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6C8200341D111C5B0053733B /* Cocoa.framework */; }; 14 | 6C82003A1D111C5B0053733B /* SourceEditorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C8200391D111C5B0053733B /* SourceEditorExtension.swift */; }; 15 | 6C82003C1D111C5B0053733B /* SourceEditorCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C82003B1D111C5B0053733B /* SourceEditorCommand.swift */; }; 16 | 6C8200401D111C5B0053733B /* SwiftLint.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 6C8200321D111C5B0053733B /* SwiftLint.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 17 | 6CB3E9C01D14F141005A3C1B /* SwiftLintHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C293C2F1D14E6AA0032DEF0 /* SwiftLintHelper.swift */; }; 18 | 6CB822391D14DB4D00BFA3FA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 6CB822381D14DB4D00BFA3FA /* main.m */; }; 19 | 6CB822531D14DF7F00BFA3FA /* SwiftLintHelper.xpc in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6CB822321D14DB4D00BFA3FA /* SwiftLintHelper.xpc */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXContainerItemProxy section */ 23 | 6C82003E1D111C5B0053733B /* PBXContainerItemProxy */ = { 24 | isa = PBXContainerItemProxy; 25 | containerPortal = 6C8200161D111C160053733B /* Project object */; 26 | proxyType = 1; 27 | remoteGlobalIDString = 6C8200311D111C5B0053733B; 28 | remoteInfo = SourceEditorExtension; 29 | }; 30 | 6CB8223B1D14DB4D00BFA3FA /* PBXContainerItemProxy */ = { 31 | isa = PBXContainerItemProxy; 32 | containerPortal = 6C8200161D111C160053733B /* Project object */; 33 | proxyType = 1; 34 | remoteGlobalIDString = 6CB822311D14DB4D00BFA3FA; 35 | remoteInfo = SwiftLintHelper; 36 | }; 37 | /* End PBXContainerItemProxy section */ 38 | 39 | /* Begin PBXCopyFilesBuildPhase section */ 40 | 6C8200441D111C5B0053733B /* Embed App Extensions */ = { 41 | isa = PBXCopyFilesBuildPhase; 42 | buildActionMask = 2147483647; 43 | dstPath = ""; 44 | dstSubfolderSpec = 13; 45 | files = ( 46 | 6C8200401D111C5B0053733B /* SwiftLint.appex in Embed App Extensions */, 47 | ); 48 | name = "Embed App Extensions"; 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | 6CB822521D14DEAA00BFA3FA /* CopyFiles */ = { 52 | isa = PBXCopyFilesBuildPhase; 53 | buildActionMask = 2147483647; 54 | dstPath = "$(CONTENTS_FOLDER_PATH)/XPCServices"; 55 | dstSubfolderSpec = 16; 56 | files = ( 57 | 6CB822531D14DF7F00BFA3FA /* SwiftLintHelper.xpc in CopyFiles */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXCopyFilesBuildPhase section */ 62 | 63 | /* Begin PBXFileReference section */ 64 | 6C293C2F1D14E6AA0032DEF0 /* SwiftLintHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwiftLintHelper.swift; sourceTree = ""; }; 65 | 6C78DFBD1D14F2F7004A31EE /* SwiftLintHelper-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SwiftLintHelper-Bridging-Header.h"; sourceTree = ""; }; 66 | 6C82001E1D111C160053733B /* SwiftLintForXcode.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftLintForXcode.app; sourceTree = BUILT_PRODUCTS_DIR; }; 67 | 6C8200211D111C160053733B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 68 | 6C8200231D111C160053733B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 69 | 6C8200261D111C160053733B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 70 | 6C8200281D111C160053733B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 71 | 6C8200321D111C5B0053733B /* SwiftLint.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = SwiftLint.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 72 | 6C8200341D111C5B0053733B /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 73 | 6C8200381D111C5B0053733B /* SwiftLint.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = SwiftLint.entitlements; sourceTree = ""; }; 74 | 6C8200391D111C5B0053733B /* SourceEditorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceEditorExtension.swift; sourceTree = ""; }; 75 | 6C82003B1D111C5B0053733B /* SourceEditorCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceEditorCommand.swift; sourceTree = ""; }; 76 | 6C82003D1D111C5B0053733B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 77 | 6CB822321D14DB4D00BFA3FA /* SwiftLintHelper.xpc */ = {isa = PBXFileReference; explicitFileType = "wrapper.xpc-service"; includeInIndex = 0; path = SwiftLintHelper.xpc; sourceTree = BUILT_PRODUCTS_DIR; }; 78 | 6CB822341D14DB4D00BFA3FA /* SwiftLintHelperProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SwiftLintHelperProtocol.h; sourceTree = ""; }; 79 | 6CB822381D14DB4D00BFA3FA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 80 | 6CB8223A1D14DB4D00BFA3FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 81 | 6CB822421D14DC0900BFA3FA /* SwiftLint-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SwiftLint-Bridging-Header.h"; sourceTree = ""; }; 82 | /* End PBXFileReference section */ 83 | 84 | /* Begin PBXFrameworksBuildPhase section */ 85 | 6C82001B1D111C160053733B /* Frameworks */ = { 86 | isa = PBXFrameworksBuildPhase; 87 | buildActionMask = 2147483647; 88 | files = ( 89 | ); 90 | runOnlyForDeploymentPostprocessing = 0; 91 | }; 92 | 6C82002F1D111C5B0053733B /* Frameworks */ = { 93 | isa = PBXFrameworksBuildPhase; 94 | buildActionMask = 2147483647; 95 | files = ( 96 | 6C8200351D111C5B0053733B /* Cocoa.framework in Frameworks */, 97 | ); 98 | runOnlyForDeploymentPostprocessing = 0; 99 | }; 100 | 6CB8222F1D14DB4D00BFA3FA /* Frameworks */ = { 101 | isa = PBXFrameworksBuildPhase; 102 | buildActionMask = 2147483647; 103 | files = ( 104 | ); 105 | runOnlyForDeploymentPostprocessing = 0; 106 | }; 107 | /* End PBXFrameworksBuildPhase section */ 108 | 109 | /* Begin PBXGroup section */ 110 | 6C8200151D111C160053733B = { 111 | isa = PBXGroup; 112 | children = ( 113 | 6C8200201D111C160053733B /* SwiftLintForXcode */, 114 | 6C8200361D111C5B0053733B /* SwiftLint */, 115 | 6CB822331D14DB4D00BFA3FA /* SwiftLintHelper */, 116 | 6C8200331D111C5B0053733B /* Frameworks */, 117 | 6C82001F1D111C160053733B /* Products */, 118 | ); 119 | sourceTree = ""; 120 | }; 121 | 6C82001F1D111C160053733B /* Products */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 6C82001E1D111C160053733B /* SwiftLintForXcode.app */, 125 | 6C8200321D111C5B0053733B /* SwiftLint.appex */, 126 | 6CB822321D14DB4D00BFA3FA /* SwiftLintHelper.xpc */, 127 | ); 128 | name = Products; 129 | sourceTree = ""; 130 | }; 131 | 6C8200201D111C160053733B /* SwiftLintForXcode */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 6C8200211D111C160053733B /* AppDelegate.swift */, 135 | 6C8200231D111C160053733B /* Assets.xcassets */, 136 | 6C8200251D111C160053733B /* MainMenu.xib */, 137 | 6C8200281D111C160053733B /* Info.plist */, 138 | ); 139 | path = SwiftLintForXcode; 140 | sourceTree = ""; 141 | }; 142 | 6C8200331D111C5B0053733B /* Frameworks */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 6C8200341D111C5B0053733B /* Cocoa.framework */, 146 | ); 147 | name = Frameworks; 148 | sourceTree = ""; 149 | }; 150 | 6C8200361D111C5B0053733B /* SwiftLint */ = { 151 | isa = PBXGroup; 152 | children = ( 153 | 6C8200391D111C5B0053733B /* SourceEditorExtension.swift */, 154 | 6C82003B1D111C5B0053733B /* SourceEditorCommand.swift */, 155 | 6C82003D1D111C5B0053733B /* Info.plist */, 156 | 6C8200371D111C5B0053733B /* Supporting Files */, 157 | 6CB822421D14DC0900BFA3FA /* SwiftLint-Bridging-Header.h */, 158 | ); 159 | path = SwiftLint; 160 | sourceTree = ""; 161 | }; 162 | 6C8200371D111C5B0053733B /* Supporting Files */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | 6C8200381D111C5B0053733B /* SwiftLint.entitlements */, 166 | ); 167 | name = "Supporting Files"; 168 | sourceTree = ""; 169 | }; 170 | 6CB822331D14DB4D00BFA3FA /* SwiftLintHelper */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | 6CB822381D14DB4D00BFA3FA /* main.m */, 174 | 6CB8223A1D14DB4D00BFA3FA /* Info.plist */, 175 | 6CB822341D14DB4D00BFA3FA /* SwiftLintHelperProtocol.h */, 176 | 6C293C2F1D14E6AA0032DEF0 /* SwiftLintHelper.swift */, 177 | 6C78DFBD1D14F2F7004A31EE /* SwiftLintHelper-Bridging-Header.h */, 178 | ); 179 | path = SwiftLintHelper; 180 | sourceTree = ""; 181 | }; 182 | /* End PBXGroup section */ 183 | 184 | /* Begin PBXNativeTarget section */ 185 | 6C82001D1D111C160053733B /* SwiftLintForXcode */ = { 186 | isa = PBXNativeTarget; 187 | buildConfigurationList = 6C82002B1D111C160053733B /* Build configuration list for PBXNativeTarget "SwiftLintForXcode" */; 188 | buildPhases = ( 189 | 6C82001A1D111C160053733B /* Sources */, 190 | 6C82001B1D111C160053733B /* Frameworks */, 191 | 6C82001C1D111C160053733B /* Resources */, 192 | 6C8200441D111C5B0053733B /* Embed App Extensions */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | 6C82003F1D111C5B0053733B /* PBXTargetDependency */, 198 | 6CB8223C1D14DB4D00BFA3FA /* PBXTargetDependency */, 199 | ); 200 | name = SwiftLintForXcode; 201 | productName = SwiftLintAutoCorrect; 202 | productReference = 6C82001E1D111C160053733B /* SwiftLintForXcode.app */; 203 | productType = "com.apple.product-type.application"; 204 | }; 205 | 6C8200311D111C5B0053733B /* SwiftLint */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 6C8200411D111C5B0053733B /* Build configuration list for PBXNativeTarget "SwiftLint" */; 208 | buildPhases = ( 209 | 6C82002E1D111C5B0053733B /* Sources */, 210 | 6C82002F1D111C5B0053733B /* Frameworks */, 211 | 6C8200301D111C5B0053733B /* Resources */, 212 | 6CB822521D14DEAA00BFA3FA /* CopyFiles */, 213 | ); 214 | buildRules = ( 215 | ); 216 | dependencies = ( 217 | ); 218 | name = SwiftLint; 219 | productName = SourceEditorExtension; 220 | productReference = 6C8200321D111C5B0053733B /* SwiftLint.appex */; 221 | productType = "com.apple.product-type.xcode-extension"; 222 | }; 223 | 6CB822311D14DB4D00BFA3FA /* SwiftLintHelper */ = { 224 | isa = PBXNativeTarget; 225 | buildConfigurationList = 6CB8223E1D14DB4D00BFA3FA /* Build configuration list for PBXNativeTarget "SwiftLintHelper" */; 226 | buildPhases = ( 227 | 6CB8222E1D14DB4D00BFA3FA /* Sources */, 228 | 6CB8222F1D14DB4D00BFA3FA /* Frameworks */, 229 | 6CB822301D14DB4D00BFA3FA /* Resources */, 230 | ); 231 | buildRules = ( 232 | ); 233 | dependencies = ( 234 | ); 235 | name = SwiftLintHelper; 236 | productName = SwiftLintHelper; 237 | productReference = 6CB822321D14DB4D00BFA3FA /* SwiftLintHelper.xpc */; 238 | productType = "com.apple.product-type.xpc-service"; 239 | }; 240 | /* End PBXNativeTarget section */ 241 | 242 | /* Begin PBXProject section */ 243 | 6C8200161D111C160053733B /* Project object */ = { 244 | isa = PBXProject; 245 | attributes = { 246 | LastSwiftUpdateCheck = 0800; 247 | LastUpgradeCheck = 0910; 248 | ORGANIZATIONNAME = "Norio Nomura"; 249 | TargetAttributes = { 250 | 6C82001D1D111C160053733B = { 251 | CreatedOnToolsVersion = 8.0; 252 | DevelopmentTeam = PK9GMQ772L; 253 | DevelopmentTeamName = "Norio Nomura"; 254 | LastSwiftMigration = 0910; 255 | ProvisioningStyle = Automatic; 256 | }; 257 | 6C8200311D111C5B0053733B = { 258 | CreatedOnToolsVersion = 8.0; 259 | DevelopmentTeam = PK9GMQ772L; 260 | DevelopmentTeamName = "Norio Nomura"; 261 | LastSwiftMigration = 0910; 262 | ProvisioningStyle = Automatic; 263 | SystemCapabilities = { 264 | com.apple.Sandbox = { 265 | enabled = 0; 266 | }; 267 | }; 268 | }; 269 | 6CB822311D14DB4D00BFA3FA = { 270 | CreatedOnToolsVersion = 8.0; 271 | DevelopmentTeam = PK9GMQ772L; 272 | DevelopmentTeamName = "Norio Nomura"; 273 | LastSwiftMigration = 0910; 274 | ProvisioningStyle = Automatic; 275 | }; 276 | }; 277 | }; 278 | buildConfigurationList = 6C8200191D111C160053733B /* Build configuration list for PBXProject "SwiftLintForXcode" */; 279 | compatibilityVersion = "Xcode 3.2"; 280 | developmentRegion = English; 281 | hasScannedForEncodings = 0; 282 | knownRegions = ( 283 | en, 284 | Base, 285 | ); 286 | mainGroup = 6C8200151D111C160053733B; 287 | productRefGroup = 6C82001F1D111C160053733B /* Products */; 288 | projectDirPath = ""; 289 | projectRoot = ""; 290 | targets = ( 291 | 6C82001D1D111C160053733B /* SwiftLintForXcode */, 292 | 6C8200311D111C5B0053733B /* SwiftLint */, 293 | 6CB822311D14DB4D00BFA3FA /* SwiftLintHelper */, 294 | ); 295 | }; 296 | /* End PBXProject section */ 297 | 298 | /* Begin PBXResourcesBuildPhase section */ 299 | 6C82001C1D111C160053733B /* Resources */ = { 300 | isa = PBXResourcesBuildPhase; 301 | buildActionMask = 2147483647; 302 | files = ( 303 | 6C8200241D111C160053733B /* Assets.xcassets in Resources */, 304 | 6C8200271D111C160053733B /* MainMenu.xib in Resources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | 6C8200301D111C5B0053733B /* Resources */ = { 309 | isa = PBXResourcesBuildPhase; 310 | buildActionMask = 2147483647; 311 | files = ( 312 | ); 313 | runOnlyForDeploymentPostprocessing = 0; 314 | }; 315 | 6CB822301D14DB4D00BFA3FA /* Resources */ = { 316 | isa = PBXResourcesBuildPhase; 317 | buildActionMask = 2147483647; 318 | files = ( 319 | ); 320 | runOnlyForDeploymentPostprocessing = 0; 321 | }; 322 | /* End PBXResourcesBuildPhase section */ 323 | 324 | /* Begin PBXSourcesBuildPhase section */ 325 | 6C82001A1D111C160053733B /* Sources */ = { 326 | isa = PBXSourcesBuildPhase; 327 | buildActionMask = 2147483647; 328 | files = ( 329 | 6C8200221D111C160053733B /* AppDelegate.swift in Sources */, 330 | ); 331 | runOnlyForDeploymentPostprocessing = 0; 332 | }; 333 | 6C82002E1D111C5B0053733B /* Sources */ = { 334 | isa = PBXSourcesBuildPhase; 335 | buildActionMask = 2147483647; 336 | files = ( 337 | 6C82003A1D111C5B0053733B /* SourceEditorExtension.swift in Sources */, 338 | 6C82003C1D111C5B0053733B /* SourceEditorCommand.swift in Sources */, 339 | ); 340 | runOnlyForDeploymentPostprocessing = 0; 341 | }; 342 | 6CB8222E1D14DB4D00BFA3FA /* Sources */ = { 343 | isa = PBXSourcesBuildPhase; 344 | buildActionMask = 2147483647; 345 | files = ( 346 | 6CB3E9C01D14F141005A3C1B /* SwiftLintHelper.swift in Sources */, 347 | 6CB822391D14DB4D00BFA3FA /* main.m in Sources */, 348 | ); 349 | runOnlyForDeploymentPostprocessing = 0; 350 | }; 351 | /* End PBXSourcesBuildPhase section */ 352 | 353 | /* Begin PBXTargetDependency section */ 354 | 6C82003F1D111C5B0053733B /* PBXTargetDependency */ = { 355 | isa = PBXTargetDependency; 356 | target = 6C8200311D111C5B0053733B /* SwiftLint */; 357 | targetProxy = 6C82003E1D111C5B0053733B /* PBXContainerItemProxy */; 358 | }; 359 | 6CB8223C1D14DB4D00BFA3FA /* PBXTargetDependency */ = { 360 | isa = PBXTargetDependency; 361 | target = 6CB822311D14DB4D00BFA3FA /* SwiftLintHelper */; 362 | targetProxy = 6CB8223B1D14DB4D00BFA3FA /* PBXContainerItemProxy */; 363 | }; 364 | /* End PBXTargetDependency section */ 365 | 366 | /* Begin PBXVariantGroup section */ 367 | 6C8200251D111C160053733B /* MainMenu.xib */ = { 368 | isa = PBXVariantGroup; 369 | children = ( 370 | 6C8200261D111C160053733B /* Base */, 371 | ); 372 | name = MainMenu.xib; 373 | sourceTree = ""; 374 | }; 375 | /* End PBXVariantGroup section */ 376 | 377 | /* Begin XCBuildConfiguration section */ 378 | 6C8200291D111C160053733B /* Debug */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ALWAYS_SEARCH_USER_PATHS = NO; 382 | CLANG_ANALYZER_NONNULL = YES; 383 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 384 | CLANG_CXX_LIBRARY = "libc++"; 385 | CLANG_ENABLE_MODULES = YES; 386 | CLANG_ENABLE_OBJC_ARC = YES; 387 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 388 | CLANG_WARN_BOOL_CONVERSION = YES; 389 | CLANG_WARN_COMMA = YES; 390 | CLANG_WARN_CONSTANT_CONVERSION = YES; 391 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 392 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 393 | CLANG_WARN_EMPTY_BODY = YES; 394 | CLANG_WARN_ENUM_CONVERSION = YES; 395 | CLANG_WARN_INFINITE_RECURSION = YES; 396 | CLANG_WARN_INT_CONVERSION = YES; 397 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 398 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 399 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 400 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 401 | CLANG_WARN_STRICT_PROTOTYPES = YES; 402 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 403 | CLANG_WARN_UNREACHABLE_CODE = YES; 404 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 405 | CODE_SIGN_IDENTITY = "-"; 406 | COPY_PHASE_STRIP = NO; 407 | DEBUG_INFORMATION_FORMAT = dwarf; 408 | DEVELOPMENT_TEAM = PK9GMQ772L; 409 | ENABLE_STRICT_OBJC_MSGSEND = YES; 410 | ENABLE_TESTABILITY = YES; 411 | GCC_C_LANGUAGE_STANDARD = gnu99; 412 | GCC_DYNAMIC_NO_PIC = NO; 413 | GCC_NO_COMMON_BLOCKS = YES; 414 | GCC_OPTIMIZATION_LEVEL = 0; 415 | GCC_PREPROCESSOR_DEFINITIONS = ( 416 | "DEBUG=1", 417 | "$(inherited)", 418 | ); 419 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 420 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 421 | GCC_WARN_UNDECLARED_SELECTOR = YES; 422 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 423 | GCC_WARN_UNUSED_FUNCTION = YES; 424 | GCC_WARN_UNUSED_VARIABLE = YES; 425 | MACOSX_DEPLOYMENT_TARGET = 10.11; 426 | MTL_ENABLE_DEBUG_INFO = YES; 427 | ONLY_ACTIVE_ARCH = YES; 428 | OTHER_LDFLAGS = "-v"; 429 | SDKROOT = macosx; 430 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 431 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 432 | SWIFT_VERSION = 4.0; 433 | }; 434 | name = Debug; 435 | }; 436 | 6C82002A1D111C160053733B /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | ALWAYS_SEARCH_USER_PATHS = NO; 440 | CLANG_ANALYZER_NONNULL = YES; 441 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 442 | CLANG_CXX_LIBRARY = "libc++"; 443 | CLANG_ENABLE_MODULES = YES; 444 | CLANG_ENABLE_OBJC_ARC = YES; 445 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 446 | CLANG_WARN_BOOL_CONVERSION = YES; 447 | CLANG_WARN_COMMA = YES; 448 | CLANG_WARN_CONSTANT_CONVERSION = YES; 449 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 450 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 451 | CLANG_WARN_EMPTY_BODY = YES; 452 | CLANG_WARN_ENUM_CONVERSION = YES; 453 | CLANG_WARN_INFINITE_RECURSION = YES; 454 | CLANG_WARN_INT_CONVERSION = YES; 455 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 456 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 457 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 458 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 459 | CLANG_WARN_STRICT_PROTOTYPES = YES; 460 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 461 | CLANG_WARN_UNREACHABLE_CODE = YES; 462 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 463 | CODE_SIGN_IDENTITY = "-"; 464 | COPY_PHASE_STRIP = NO; 465 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 466 | DEVELOPMENT_TEAM = PK9GMQ772L; 467 | ENABLE_NS_ASSERTIONS = NO; 468 | ENABLE_STRICT_OBJC_MSGSEND = YES; 469 | GCC_C_LANGUAGE_STANDARD = gnu99; 470 | GCC_NO_COMMON_BLOCKS = YES; 471 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 472 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 473 | GCC_WARN_UNDECLARED_SELECTOR = YES; 474 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 475 | GCC_WARN_UNUSED_FUNCTION = YES; 476 | GCC_WARN_UNUSED_VARIABLE = YES; 477 | MACOSX_DEPLOYMENT_TARGET = 10.11; 478 | MTL_ENABLE_DEBUG_INFO = NO; 479 | OTHER_LDFLAGS = "-v"; 480 | SDKROOT = macosx; 481 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 482 | SWIFT_VERSION = 4.0; 483 | }; 484 | name = Release; 485 | }; 486 | 6C82002C1D111C160053733B /* Debug */ = { 487 | isa = XCBuildConfiguration; 488 | buildSettings = { 489 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 490 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 491 | CODE_SIGN_IDENTITY = "Mac Developer"; 492 | COMBINE_HIDPI_IMAGES = YES; 493 | INFOPLIST_FILE = SwiftLintForXcode/Info.plist; 494 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 495 | PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.SwiftLintForXcode"; 496 | PRODUCT_NAME = "$(TARGET_NAME)"; 497 | }; 498 | name = Debug; 499 | }; 500 | 6C82002D1D111C160053733B /* Release */ = { 501 | isa = XCBuildConfiguration; 502 | buildSettings = { 503 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 504 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 505 | CODE_SIGN_IDENTITY = "Mac Developer"; 506 | COMBINE_HIDPI_IMAGES = YES; 507 | INFOPLIST_FILE = SwiftLintForXcode/Info.plist; 508 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 509 | PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.SwiftLintForXcode"; 510 | PRODUCT_NAME = "$(TARGET_NAME)"; 511 | }; 512 | name = Release; 513 | }; 514 | 6C8200421D111C5B0053733B /* Debug */ = { 515 | isa = XCBuildConfiguration; 516 | buildSettings = { 517 | CLANG_ENABLE_MODULES = YES; 518 | CODE_SIGN_ENTITLEMENTS = SwiftLint/SwiftLint.entitlements; 519 | CODE_SIGN_IDENTITY = "Mac Developer"; 520 | COMBINE_HIDPI_IMAGES = YES; 521 | INFOPLIST_FILE = SwiftLint/Info.plist; 522 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks"; 523 | MACOSX_DEPLOYMENT_TARGET = 10.11; 524 | PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.SwiftLintForXcode.SwiftLint"; 525 | PRODUCT_NAME = "$(TARGET_NAME)"; 526 | SKIP_INSTALL = YES; 527 | SWIFT_OBJC_BRIDGING_HEADER = "SwiftLint/SwiftLint-Bridging-Header.h"; 528 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 529 | }; 530 | name = Debug; 531 | }; 532 | 6C8200431D111C5B0053733B /* Release */ = { 533 | isa = XCBuildConfiguration; 534 | buildSettings = { 535 | CLANG_ENABLE_MODULES = YES; 536 | CODE_SIGN_ENTITLEMENTS = SwiftLint/SwiftLint.entitlements; 537 | CODE_SIGN_IDENTITY = "Mac Developer"; 538 | COMBINE_HIDPI_IMAGES = YES; 539 | INFOPLIST_FILE = SwiftLint/Info.plist; 540 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks"; 541 | MACOSX_DEPLOYMENT_TARGET = 10.11; 542 | PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.SwiftLintForXcode.SwiftLint"; 543 | PRODUCT_NAME = "$(TARGET_NAME)"; 544 | SKIP_INSTALL = YES; 545 | SWIFT_OBJC_BRIDGING_HEADER = "SwiftLint/SwiftLint-Bridging-Header.h"; 546 | }; 547 | name = Release; 548 | }; 549 | 6CB8223F1D14DB4D00BFA3FA /* Debug */ = { 550 | isa = XCBuildConfiguration; 551 | buildSettings = { 552 | CLANG_ENABLE_MODULES = YES; 553 | CODE_SIGN_IDENTITY = "Mac Developer"; 554 | COMBINE_HIDPI_IMAGES = YES; 555 | INFOPLIST_FILE = SwiftLintHelper/Info.plist; 556 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks @executable_path/../../../../../../../Frameworks"; 557 | PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.SwiftLintForXcode.SwiftLintHelper"; 558 | PRODUCT_NAME = "$(TARGET_NAME)"; 559 | SKIP_INSTALL = YES; 560 | SWIFT_OBJC_BRIDGING_HEADER = "SwiftLintHelper/SwiftLintHelper-Bridging-Header.h"; 561 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 562 | }; 563 | name = Debug; 564 | }; 565 | 6CB822401D14DB4D00BFA3FA /* Release */ = { 566 | isa = XCBuildConfiguration; 567 | buildSettings = { 568 | CLANG_ENABLE_MODULES = YES; 569 | CODE_SIGN_IDENTITY = "Mac Developer"; 570 | COMBINE_HIDPI_IMAGES = YES; 571 | INFOPLIST_FILE = SwiftLintHelper/Info.plist; 572 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks @executable_path/../../../../../../../Frameworks"; 573 | PRODUCT_BUNDLE_IDENTIFIER = "io.github.norio-nomura.SwiftLintForXcode.SwiftLintHelper"; 574 | PRODUCT_NAME = "$(TARGET_NAME)"; 575 | SKIP_INSTALL = YES; 576 | SWIFT_OBJC_BRIDGING_HEADER = "SwiftLintHelper/SwiftLintHelper-Bridging-Header.h"; 577 | }; 578 | name = Release; 579 | }; 580 | /* End XCBuildConfiguration section */ 581 | 582 | /* Begin XCConfigurationList section */ 583 | 6C8200191D111C160053733B /* Build configuration list for PBXProject "SwiftLintForXcode" */ = { 584 | isa = XCConfigurationList; 585 | buildConfigurations = ( 586 | 6C8200291D111C160053733B /* Debug */, 587 | 6C82002A1D111C160053733B /* Release */, 588 | ); 589 | defaultConfigurationIsVisible = 0; 590 | defaultConfigurationName = Release; 591 | }; 592 | 6C82002B1D111C160053733B /* Build configuration list for PBXNativeTarget "SwiftLintForXcode" */ = { 593 | isa = XCConfigurationList; 594 | buildConfigurations = ( 595 | 6C82002C1D111C160053733B /* Debug */, 596 | 6C82002D1D111C160053733B /* Release */, 597 | ); 598 | defaultConfigurationIsVisible = 0; 599 | defaultConfigurationName = Release; 600 | }; 601 | 6C8200411D111C5B0053733B /* Build configuration list for PBXNativeTarget "SwiftLint" */ = { 602 | isa = XCConfigurationList; 603 | buildConfigurations = ( 604 | 6C8200421D111C5B0053733B /* Debug */, 605 | 6C8200431D111C5B0053733B /* Release */, 606 | ); 607 | defaultConfigurationIsVisible = 0; 608 | defaultConfigurationName = Release; 609 | }; 610 | 6CB8223E1D14DB4D00BFA3FA /* Build configuration list for PBXNativeTarget "SwiftLintHelper" */ = { 611 | isa = XCConfigurationList; 612 | buildConfigurations = ( 613 | 6CB8223F1D14DB4D00BFA3FA /* Debug */, 614 | 6CB822401D14DB4D00BFA3FA /* Release */, 615 | ); 616 | defaultConfigurationIsVisible = 0; 617 | defaultConfigurationName = Release; 618 | }; 619 | /* End XCConfigurationList section */ 620 | }; 621 | rootObject = 6C8200161D111C160053733B /* Project object */; 622 | } 623 | -------------------------------------------------------------------------------- /SwiftLintForXcode.xcodeproj/xcshareddata/xcschemes/SwiftLint.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | 10 | 16 | 22 | 23 | 24 | 30 | 36 | 37 | 38 | 39 | 40 | 46 | 47 | 48 | 49 | 55 | 56 | 57 | 58 | 59 | 60 | 71 | 75 | 76 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 95 | 97 | 103 | 104 | 105 | 106 | 108 | 109 | 112 | 113 | 114 | -------------------------------------------------------------------------------- /SwiftLintForXcode.xcodeproj/xcshareddata/xcschemes/SwiftLintForXcode.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /SwiftLintForXcode.xcodeproj/xcshareddata/xcschemes/SwiftLintHelper.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 47 | 50 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /SwiftLintForXcode/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftLintForXcode 4 | // 5 | // Created by 野村 憲男 on 6/15/16. 6 | // 7 | // Copyright (c) 2016 Norio Nomura 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | import Cocoa 29 | 30 | @NSApplicationMain 31 | class AppDelegate: NSObject, NSApplicationDelegate { 32 | 33 | @IBOutlet weak var window: NSWindow! 34 | 35 | func applicationDidFinishLaunching(_ aNotification: Notification) { 36 | // Insert code here to initialize your application 37 | } 38 | 39 | func applicationWillTerminate(_ aNotification: Notification) { 40 | // Insert code here to tear down your application 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /SwiftLintForXcode/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 | } -------------------------------------------------------------------------------- /SwiftLintForXcode/Base.lproj/MainMenu.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 | 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 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | Default 538 | 539 | 540 | 541 | 542 | 543 | 544 | Left to Right 545 | 546 | 547 | 548 | 549 | 550 | 551 | Right to Left 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | Default 563 | 564 | 565 | 566 | 567 | 568 | 569 | Left to Right 570 | 571 | 572 | 573 | 574 | 575 | 576 | Right to Left 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 | -------------------------------------------------------------------------------- /SwiftLintForXcode/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 | 0.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2016 Norio Nomura. All rights reserved. 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /SwiftLintHelper/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | SwiftLintHelper 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 | 0.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | NSHumanReadableCopyright 26 | Copyright © 2016 Norio Nomura. All rights reserved. 27 | XPCService 28 | 29 | ServiceType 30 | Application 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /SwiftLintHelper/SwiftLintHelper-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "SwiftLintHelperProtocol.h" 6 | -------------------------------------------------------------------------------- /SwiftLintHelper/SwiftLintHelper.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftLintHelper.swift 3 | // SwiftLintHelper 4 | // 5 | // Created by 野村 憲男 on 6/18/16. 6 | // 7 | // Copyright (c) 2016 Norio Nomura 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | import Foundation 29 | 30 | @objc class SwiftLintHelper: NSObject, SwiftLintHelperProtocol { 31 | func execute(in directory: String, with arguments: [String], reply: @escaping SwiftLintHelperResultHandler) { 32 | 33 | let task = Process(), stdout = Pipe(), stderr = Pipe() 34 | task.launchPath = "/usr/bin/env" 35 | task.arguments = ["/usr/local/bin/swiftlint"] + arguments 36 | task.currentDirectoryPath = directory 37 | task.standardOutput = stdout 38 | task.standardError = stderr 39 | task.launch() 40 | let output = String(data: stdout.fileHandleForReading.readDataToEndOfFile(), 41 | encoding: .utf8) ?? "" 42 | let errorOutput = String(data: stderr.fileHandleForReading.readDataToEndOfFile(), 43 | encoding: .utf8) ?? "" 44 | reply(Int(task.terminationStatus), output, errorOutput) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SwiftLintHelper/SwiftLintHelperProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftLintHelperProtocol.h 3 | // SwiftLintHelper 4 | // 5 | // Created by 野村 憲男 on 6/18/16. 6 | // 7 | // Copyright (c) 2016 Norio Nomura 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | @import Foundation; 28 | 29 | typedef void (^SwiftLintHelperResultHandler)(NSInteger status, NSString * _Nonnull, NSString * _Nonnull); 30 | 31 | @protocol SwiftLintHelperProtocol 32 | 33 | - (void)executeInDirectory:(NSString * _Nonnull)directory 34 | withArguments:(NSArray * _Nonnull)arguments 35 | reply:(SwiftLintHelperResultHandler _Nonnull)reply 36 | NS_SWIFT_NAME(execute(in:with:reply:)); 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /SwiftLintHelper/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // SwiftLintHelper 4 | // 5 | // Created by 野村 憲男 on 6/18/16. 6 | // 7 | // Copyright (c) 2016 Norio Nomura 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | #import 29 | #import "SwiftLintHelper-Swift.h" 30 | 31 | @interface ServiceDelegate : NSObject 32 | @end 33 | 34 | @implementation ServiceDelegate 35 | 36 | - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection { 37 | // This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection. 38 | 39 | // Configure the connection. 40 | // First, set the interface that the exported object implements. 41 | newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SwiftLintHelperProtocol)]; 42 | 43 | // Next, set the object that the connection exports. All messages sent on the connection to this service will be sent to the exported object to handle. The connection retains the exported object. 44 | SwiftLintHelper *exportedObject = [SwiftLintHelper new]; 45 | newConnection.exportedObject = exportedObject; 46 | 47 | // Resuming the connection allows the system to deliver more incoming messages. 48 | [newConnection resume]; 49 | 50 | // Returning YES from this method tells the system that you have accepted this connection. If you want to reject the connection for some reason, call -invalidate on the connection and return NO. 51 | return YES; 52 | } 53 | 54 | @end 55 | 56 | int main(int argc, const char *argv[]) 57 | { 58 | // Create the delegate for the service. 59 | ServiceDelegate *delegate = [ServiceDelegate new]; 60 | 61 | // Set up the one NSXPCListener for this service. It will handle all incoming connections. 62 | NSXPCListener *listener = [NSXPCListener serviceListener]; 63 | listener.delegate = delegate; 64 | 65 | // Resuming the serviceListener starts this service. This method does not return. 66 | [listener resume]; 67 | return 0; 68 | } 69 | --------------------------------------------------------------------------------