├── .gitignore
├── LICENSE
├── README.md
├── Recources
├── example.gif
├── hotkeys.png
├── icon.png
├── installation.png
├── malicious.png
└── videofix.png
├── SourceEditorExtension
├── Generator.swift
├── Helpers
│ ├── SourceEditorCommand.swift
│ └── SourceEditorExtension.swift
├── Info.plist
├── SourceEditorExtension.entitlements
└── Variable.swift
├── SwiftInitGenerator.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── xcshareddata
│ └── xcschemes
│ ├── SourceEditorExtension.xcscheme
│ └── SwiftInitGenerator.xcscheme
├── SwiftInitGenerator
├── AppDelegate.swift
├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-1024.png
│ │ ├── Icon-128.png
│ │ ├── Icon-16.png
│ │ ├── Icon-256.png
│ │ ├── Icon-32.png
│ │ ├── Icon-512.png
│ │ └── Icon-64.png
│ └── Contents.json
├── Base.lproj
│ └── Main.storyboard
├── Info.plist
└── SwiftInitGenerator.entitlements
└── SwiftInitGeneratorTests
├── Info.plist
└── SwiftInitGeneratorTests.swift
/.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 | *.xccheckout
23 | *.xcscmblueprint
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 | *.ipa
28 | *.dSYM.zip
29 | *.dSYM
30 |
31 | ## Playgrounds
32 | timeline.xctimeline
33 | playground.xcworkspace
34 |
35 | # Swift Package Manager
36 | #
37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
38 | # Packages/
39 | # Package.pins
40 | # Package.resolved
41 | .build/
42 |
43 | # CocoaPods
44 | #
45 | # We recommend against adding the Pods directory to your .gitignore. However
46 | # you should judge for yourself, the pros and cons are mentioned at:
47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
48 | #
49 | # Pods/
50 |
51 | # Carthage
52 | #
53 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
54 | # Carthage/Checkouts
55 |
56 | Carthage/Build
57 |
58 | # fastlane
59 | #
60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
61 | # screenshots whenever they are needed.
62 | # For more information about the recommended setup visit:
63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
64 |
65 | fastlane/report.xml
66 | fastlane/Preview.html
67 | fastlane/screenshots/**/*.png
68 | fastlane/test_output
69 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Maxim Smirnov
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | # Swift Init Generator
6 |
7 | [](#) [](https://twitter.com/atimca)
8 |
9 | **Swift Init Generator** is an Xcode Source Editor extension that makes it easy to generate your init, especially for public types.
10 |
11 | ## Features
12 |
13 | - [X] ⚒ No longer hack your Xcode to install custom plugins.
14 | - [X] 📃 Generate Init from any selected variables, filter static, computed and etc.
15 |
16 | ## Examples
17 |
18 | ### Generation From The Selected Lines
19 |
20 | 
21 |
22 | ## Installation
23 |
24 | **Option 1:**
25 | - Download latest *SwiftInitGenerator* package from the [Releases](https://github.com/Atimca/SwiftInitGenerator/releases).
26 | - Copy *SwiftInitGenerator* to your *Applications* folder.
27 | - Launch *SwiftInitGenerator* once. You can close it immediately afterwards.
28 | - Go to System Preferences > Extensions > Xcode Source Editor > select Swift Init Generator
29 |
30 | 
31 |
32 | If you have this alert:
33 |
34 | > “SwiftInitGenerator” can’t be opened because Apple cannot check it for malicious software.
35 | 
36 |
37 | Please watch this video for instruction steps:
38 | [](https://youtu.be/T7LXprbqm3E)
39 |
40 | **Option 2:**
41 | - Just download source code and build it on your machine😉
42 |
43 | ## Setting Hotkey in Xcode
44 |
45 | - Open Xcode
46 | - Go to Xcode > Preferences > Key Bindings
47 | - Type *'Swift Init Generator'* in search field
48 | - Assign ⌃ + ⌘ + ⎇ + I to *Generate Init From Selected Lines*
49 |
50 | 
51 |
52 | ## Feedback
53 |
54 | Pull requests, issues and suggestions are warmly welcome.
55 |
--------------------------------------------------------------------------------
/Recources/example.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/Recources/example.gif
--------------------------------------------------------------------------------
/Recources/hotkeys.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/Recources/hotkeys.png
--------------------------------------------------------------------------------
/Recources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/Recources/icon.png
--------------------------------------------------------------------------------
/Recources/installation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/Recources/installation.png
--------------------------------------------------------------------------------
/Recources/malicious.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/Recources/malicious.png
--------------------------------------------------------------------------------
/Recources/videofix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/Recources/videofix.png
--------------------------------------------------------------------------------
/SourceEditorExtension/Generator.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Smirnov Maxim on 29/11/2018.
3 | // Copyright © 2018 Smirnov Maxim. All rights reserved.
4 | //
5 |
6 | import Foundation
7 |
8 | enum Generator {
9 | /// Function that generates init.
10 | /// - Parameter selection: Array of selected lines.
11 | /// - Parameter indentation:
12 | /// - Parameter leadingIndent:
13 | static func generate(selection: [String], indentation: String, leadingIndent: String) -> [String] {
14 | let variables = VariablesGenerator.generate(from: selection).filter { !$0.needToSkipInInitGeneration }
15 | guard !variables.isEmpty else { return ["public init() { }"] }
16 | let generatedInit = generateInit(variables.map(argument))
17 | let expressions = variables.map { expression(variable: $0, indentation: indentation) }
18 | let lines = (generatedInit + expressions + ["}"]).map { "\(leadingIndent)\($0)" }
19 |
20 | return lines
21 | }
22 |
23 | private static func expression(variable: Variable, indentation: String) -> String {
24 |
25 | if variable.name.first == "_" {
26 | var name = variable.name
27 | name.removeFirst()
28 | return "\(indentation)\(variable.name) = \(name)"
29 | }
30 |
31 | return "\(indentation)self.\(variable.name) = \(variable.name)"
32 | }
33 |
34 | private static func argument(variable: Variable) -> String {
35 |
36 | var name = variable.name
37 | if variable.name.first == "_" {
38 | name.removeFirst()
39 | }
40 |
41 | return "\(name): \(addEscapingAttributeIfNeeded(to: variable.type))"
42 | }
43 |
44 | private static func generateInit(_ arguments: [String]) -> [String] {
45 |
46 | guard arguments.joined(separator: ", ").count > 80 else {
47 | return ["public init(" + arguments.joined(separator: ", ") + ") {"]
48 | }
49 |
50 | var indent: String = ""
51 | "public init(".forEach { _ in
52 | indent.append(" ")
53 | }
54 |
55 | var result: [String] = []
56 |
57 | for (i, argument) in arguments.enumerated() {
58 |
59 | if i == 0 {
60 | var line = "public init(" + argument
61 | if arguments.count != 1 {
62 | line.append(",")
63 | } else {
64 | line.append(") {")
65 | }
66 | result.append(line)
67 | continue
68 | }
69 |
70 | if i == (arguments.count - 1) {
71 | result.append(indent + argument + ") {")
72 | continue
73 | }
74 |
75 | result.append(indent + argument + ",")
76 | }
77 |
78 | return result
79 | }
80 |
81 | private static func addEscapingAttributeIfNeeded(to typeString: String) -> String {
82 | let predicate = NSPredicate(format: "SELF MATCHES %@", "\\(.*\\)->.*")
83 | if predicate.evaluate(with: typeString.replacingOccurrences(of: " ", with: "")),
84 | !isOptional(typeString: typeString) {
85 | return "@escaping " + typeString
86 | } else {
87 | return typeString
88 | }
89 | }
90 |
91 | private static func isOptional(typeString: String) -> Bool {
92 | guard typeString.hasSuffix("!") || typeString.hasSuffix("?") else {
93 | return false
94 | }
95 | var balance = 0
96 | var indexOfClosingBraceMatchingFirstOpenBrace: Int?
97 |
98 | for (index, character) in typeString.enumerated() {
99 | if character == "(" {
100 | balance += 1
101 | } else if character == ")" {
102 | balance -= 1
103 | }
104 | if balance == 0 {
105 | indexOfClosingBraceMatchingFirstOpenBrace = index
106 | break
107 | }
108 | }
109 |
110 | return indexOfClosingBraceMatchingFirstOpenBrace == typeString.count - 2
111 | }
112 |
113 | }
114 |
115 | private enum VariablesGenerator {
116 |
117 | static func generate(from selection: [String]) -> [Variable] {
118 | return selection
119 | .multiLineCommentsRemoved
120 | .map(removeSingleLineComment)
121 | .map(removeNewLineSymbol)
122 | .map { $0.split(separator: " ") }
123 | .map(removeAllTypePrefixes)
124 | .map(convertPrepreparedArrayToVariable)
125 | .compactMap { $0 }
126 | }
127 |
128 | private static func removeSingleLineComment(for string: String) -> String {
129 | var mutable = string
130 | if let startOfComments = mutable.range(of: "//") {
131 | mutable.removeSubrange(startOfComments.lowerBound.. String {
137 | var mutable = string
138 | if let newLineSymbolPosition = mutable.range(of: "\n") {
139 | mutable.removeSubrange(newLineSymbolPosition)
140 | }
141 | return mutable
142 | }
143 |
144 | private static func removeAllTypePrefixes(for array: [Substring]) -> [Substring] {
145 | var mutable = array
146 | guard let mutabilityIdentifierIndex = mutable.firstIndex(where: { $0.contains("var") || $0.contains("let") }) else { return [] }
147 | if mutabilityIdentifierIndex == mutable.startIndex { return mutable }
148 | mutable.removeSubrange(mutable.startIndex.. Variable? {
153 | guard array.count >= 3 else { return nil }
154 | var line = array.map(String.init)
155 | let mutabilityIdentifier = line.removeFirst()
156 | var name = line.removeFirst()
157 | name.removeAll { $0 == ":" }
158 | let type = line.joined(separator: " ")
159 | return Variable(name: name, type: type, isMutable: mutabilityIdentifier.contains("var"))
160 | }
161 | }
162 |
163 | private extension Array where Element == String {
164 | var multiLineCommentsRemoved: [String] {
165 | var selection = self
166 | if let openCommentIndex = selection.firstIndex(where: { $0.contains("/*") }), openCommentIndex != selection.endIndex {
167 | let closeCommentIndex = selection.firstIndex { $0.contains("*/") } ?? selection.endIndex
168 | selection.removeSubrange(openCommentIndex...closeCommentIndex)
169 | }
170 | if selection.contains(where: { $0.contains("/*") || $0.contains("*/") }) {
171 | selection = selection.multiLineCommentsRemoved
172 | }
173 |
174 | return selection
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/SourceEditorExtension/Helpers/SourceEditorCommand.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Smirnov Maxim on 29/11/2018.
3 | // Copyright © 2018 Smirnov Maxim. All rights reserved.
4 | //
5 |
6 | import Foundation
7 | import XcodeKit
8 |
9 | enum GenerationError: Swift.Error {
10 | case notSwiftLanguage
11 | case noSelection
12 | case invalidSelection
13 | case parseError
14 | }
15 |
16 | class SourceEditorCommand: NSObject, XCSourceEditorCommand {
17 |
18 | func perform(with invocation: XCSourceEditorCommandInvocation, completionHandler: @escaping (Swift.Error?) -> Void) {
19 | do {
20 | try generateInitializer(invocation: invocation)
21 | completionHandler(nil)
22 | } catch {
23 | completionHandler(error)
24 | }
25 | }
26 |
27 | private func generateInitializer(invocation: XCSourceEditorCommandInvocation) throws {
28 | guard invocation.buffer.contentUTI == "public.swift-source" else {
29 | throw GenerationError.notSwiftLanguage
30 | }
31 | guard let selection = invocation.buffer.selections.firstObject as? XCSourceTextRange else {
32 | throw GenerationError.noSelection
33 | }
34 |
35 | let selectedText: [String]
36 | if selection.start.line == selection.end.line {
37 | selectedText = [String(
38 | (invocation.buffer.lines[selection.start.line] as! String).utf8
39 | .prefix(selection.end.column)
40 | .dropFirst(selection.start.column)
41 | )!]
42 | } else {
43 | selectedText = [String((invocation.buffer.lines[selection.start.line] as! String).utf8.dropFirst(selection.start.column))!]
44 | + ((selection.start.line+1).. String {
62 | return buffer.usesTabsForIndentation
63 | ? "\t"
64 | : String(repeating: " ", count: buffer.indentationWidth)
65 | }
66 |
67 | private func leadingIndentation(from selection: XCSourceTextRange, in buffer: XCSourceTextBuffer) -> String {
68 | let firstLineOfSelection = buffer.lines[selection.start.line] as! String
69 |
70 | if let nonWhitespace = firstLineOfSelection.rangeOfCharacter(from: CharacterSet.whitespaces.inverted) {
71 | return String(firstLineOfSelection.prefix(upTo: nonWhitespace.lowerBound))
72 | } else {
73 | return ""
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/SourceEditorExtension/Helpers/SourceEditorExtension.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Smirnov Maxim on 29/11/2018.
3 | // Copyright © 2018 Smirnov Maxim. All rights reserved.
4 | //
5 |
6 | import Foundation
7 | import XcodeKit
8 |
9 | class SourceEditorExtension: NSObject, XCSourceEditorExtension { }
10 |
--------------------------------------------------------------------------------
/SourceEditorExtension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Swift Init Generator
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 | $(MARKETING_VERSION)
21 | CFBundleVersion
22 | 1
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSExtension
26 |
27 | NSExtensionAttributes
28 |
29 | XCSourceEditorCommandDefinitions
30 |
31 |
32 | XCSourceEditorCommandClassName
33 | $(PRODUCT_MODULE_NAME).SourceEditorCommand
34 | XCSourceEditorCommandIdentifier
35 | $(PRODUCT_BUNDLE_IDENTIFIER).SourceEditorCommand
36 | XCSourceEditorCommandName
37 | Generate Init From Selected Lines
38 |
39 |
40 | XCSourceEditorExtensionPrincipalClass
41 | $(PRODUCT_MODULE_NAME).SourceEditorExtension
42 |
43 | NSExtensionPointIdentifier
44 | com.apple.dt.Xcode.extension.source-editor
45 |
46 | NSHumanReadableCopyright
47 | Copyright © 2018 atimca.com. All rights reserved.
48 |
49 |
50 |
--------------------------------------------------------------------------------
/SourceEditorExtension/SourceEditorExtension.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SourceEditorExtension/Variable.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Maxim Smirnov on 12/09/2019.
3 | // Copyright © 2019 atimca.com. All rights reserved.
4 | //
5 |
6 | struct Variable {
7 |
8 | let name: String
9 | let type: String
10 | let isMutable: Bool
11 |
12 | var containsDefaultValue: Bool {
13 | return type.contains("=")
14 | }
15 | var isComputed: Bool {
16 | return type.contains(" {")
17 | }
18 | }
19 |
20 | extension Variable {
21 | var needToSkipInInitGeneration: Bool {
22 | if !isMutable, containsDefaultValue {
23 | return true
24 | }
25 |
26 | if isComputed {
27 | return true
28 | }
29 |
30 | return false
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/SwiftInitGenerator.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 64F47454232A6FBE009E69FC /* Variable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F47453232A6FBE009E69FC /* Variable.swift */; };
11 | 64F47455232A6FBE009E69FC /* Variable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F47453232A6FBE009E69FC /* Variable.swift */; };
12 | E4D8F82721B0424300DF0B51 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4D8F82621B0424300DF0B51 /* Cocoa.framework */; };
13 | E4D8F83121B0424300DF0B51 /* Swift Init Generator.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = E4D8F82421B0424300DF0B51 /* Swift Init Generator.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
14 | E4D8F83A21B0435200DF0B51 /* SourceEditorCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D8F83621B0435200DF0B51 /* SourceEditorCommand.swift */; };
15 | E4D8F83C21B0435200DF0B51 /* SourceEditorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D8F83821B0435200DF0B51 /* SourceEditorExtension.swift */; };
16 | E4D8F83D21B0435200DF0B51 /* Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D8F83921B0435200DF0B51 /* Generator.swift */; };
17 | E4D8F83F21B0441200DF0B51 /* Generator.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4D8F83921B0435200DF0B51 /* Generator.swift */; };
18 | E4E82B4E21B041F9008124BE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E82B4D21B041F9008124BE /* AppDelegate.swift */; };
19 | E4E82B5221B041FA008124BE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E4E82B5121B041FA008124BE /* Assets.xcassets */; };
20 | E4E82B5521B041FA008124BE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E4E82B5321B041FA008124BE /* Main.storyboard */; };
21 | E4E82B6121B041FA008124BE /* SwiftInitGeneratorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4E82B6021B041FA008124BE /* SwiftInitGeneratorTests.swift */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXContainerItemProxy section */
25 | E4D8F82F21B0424300DF0B51 /* PBXContainerItemProxy */ = {
26 | isa = PBXContainerItemProxy;
27 | containerPortal = E4E82B4221B041F9008124BE /* Project object */;
28 | proxyType = 1;
29 | remoteGlobalIDString = E4D8F82321B0424300DF0B51;
30 | remoteInfo = SourceEditorExtension;
31 | };
32 | E4E82B5D21B041FA008124BE /* PBXContainerItemProxy */ = {
33 | isa = PBXContainerItemProxy;
34 | containerPortal = E4E82B4221B041F9008124BE /* Project object */;
35 | proxyType = 1;
36 | remoteGlobalIDString = E4E82B4921B041F9008124BE;
37 | remoteInfo = SwiftInitGenerator;
38 | };
39 | /* End PBXContainerItemProxy section */
40 |
41 | /* Begin PBXCopyFilesBuildPhase section */
42 | E4D8F83521B0424300DF0B51 /* Embed App Extensions */ = {
43 | isa = PBXCopyFilesBuildPhase;
44 | buildActionMask = 2147483647;
45 | dstPath = "";
46 | dstSubfolderSpec = 13;
47 | files = (
48 | E4D8F83121B0424300DF0B51 /* Swift Init Generator.appex in Embed App Extensions */,
49 | );
50 | name = "Embed App Extensions";
51 | runOnlyForDeploymentPostprocessing = 0;
52 | };
53 | /* End PBXCopyFilesBuildPhase section */
54 |
55 | /* Begin PBXFileReference section */
56 | 64F47453232A6FBE009E69FC /* Variable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Variable.swift; sourceTree = ""; };
57 | E4D8F82421B0424300DF0B51 /* Swift Init Generator.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Swift Init Generator.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
58 | E4D8F82621B0424300DF0B51 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
59 | E4D8F82D21B0424300DF0B51 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
60 | E4D8F82E21B0424300DF0B51 /* SourceEditorExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SourceEditorExtension.entitlements; sourceTree = ""; };
61 | E4D8F83621B0435200DF0B51 /* SourceEditorCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceEditorCommand.swift; sourceTree = ""; };
62 | E4D8F83821B0435200DF0B51 /* SourceEditorExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceEditorExtension.swift; sourceTree = ""; };
63 | E4D8F83921B0435200DF0B51 /* Generator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Generator.swift; sourceTree = ""; };
64 | E4E82B4A21B041F9008124BE /* SwiftInitGenerator.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftInitGenerator.app; sourceTree = BUILT_PRODUCTS_DIR; };
65 | E4E82B4D21B041F9008124BE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
66 | E4E82B5121B041FA008124BE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
67 | E4E82B5421B041FA008124BE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
68 | E4E82B5621B041FA008124BE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
69 | E4E82B5721B041FA008124BE /* SwiftInitGenerator.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = SwiftInitGenerator.entitlements; sourceTree = ""; };
70 | E4E82B5C21B041FA008124BE /* SwiftInitGeneratorTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftInitGeneratorTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
71 | E4E82B6021B041FA008124BE /* SwiftInitGeneratorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftInitGeneratorTests.swift; sourceTree = ""; };
72 | E4E82B6221B041FA008124BE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
73 | /* End PBXFileReference section */
74 |
75 | /* Begin PBXFrameworksBuildPhase section */
76 | E4D8F82121B0424300DF0B51 /* Frameworks */ = {
77 | isa = PBXFrameworksBuildPhase;
78 | buildActionMask = 2147483647;
79 | files = (
80 | E4D8F82721B0424300DF0B51 /* Cocoa.framework in Frameworks */,
81 | );
82 | runOnlyForDeploymentPostprocessing = 0;
83 | };
84 | E4E82B4721B041F9008124BE /* Frameworks */ = {
85 | isa = PBXFrameworksBuildPhase;
86 | buildActionMask = 2147483647;
87 | files = (
88 | );
89 | runOnlyForDeploymentPostprocessing = 0;
90 | };
91 | E4E82B5921B041FA008124BE /* Frameworks */ = {
92 | isa = PBXFrameworksBuildPhase;
93 | buildActionMask = 2147483647;
94 | files = (
95 | );
96 | runOnlyForDeploymentPostprocessing = 0;
97 | };
98 | /* End PBXFrameworksBuildPhase section */
99 |
100 | /* Begin PBXGroup section */
101 | E4D8F82521B0424300DF0B51 /* Frameworks */ = {
102 | isa = PBXGroup;
103 | children = (
104 | E4D8F82621B0424300DF0B51 /* Cocoa.framework */,
105 | );
106 | name = Frameworks;
107 | sourceTree = "";
108 | };
109 | E4D8F82821B0424300DF0B51 /* SourceEditorExtension */ = {
110 | isa = PBXGroup;
111 | children = (
112 | E4D8F83E21B0435A00DF0B51 /* Helpers */,
113 | E4D8F83921B0435200DF0B51 /* Generator.swift */,
114 | 64F47453232A6FBE009E69FC /* Variable.swift */,
115 | E4D8F82D21B0424300DF0B51 /* Info.plist */,
116 | E4D8F82E21B0424300DF0B51 /* SourceEditorExtension.entitlements */,
117 | );
118 | path = SourceEditorExtension;
119 | sourceTree = "";
120 | };
121 | E4D8F83E21B0435A00DF0B51 /* Helpers */ = {
122 | isa = PBXGroup;
123 | children = (
124 | E4D8F83621B0435200DF0B51 /* SourceEditorCommand.swift */,
125 | E4D8F83821B0435200DF0B51 /* SourceEditorExtension.swift */,
126 | );
127 | path = Helpers;
128 | sourceTree = "";
129 | };
130 | E4E82B4121B041F9008124BE = {
131 | isa = PBXGroup;
132 | children = (
133 | E4E82B4C21B041F9008124BE /* SwiftInitGenerator */,
134 | E4E82B5F21B041FA008124BE /* SwiftInitGeneratorTests */,
135 | E4D8F82821B0424300DF0B51 /* SourceEditorExtension */,
136 | E4D8F82521B0424300DF0B51 /* Frameworks */,
137 | E4E82B4B21B041F9008124BE /* Products */,
138 | );
139 | sourceTree = "";
140 | };
141 | E4E82B4B21B041F9008124BE /* Products */ = {
142 | isa = PBXGroup;
143 | children = (
144 | E4E82B4A21B041F9008124BE /* SwiftInitGenerator.app */,
145 | E4E82B5C21B041FA008124BE /* SwiftInitGeneratorTests.xctest */,
146 | E4D8F82421B0424300DF0B51 /* Swift Init Generator.appex */,
147 | );
148 | name = Products;
149 | sourceTree = "";
150 | };
151 | E4E82B4C21B041F9008124BE /* SwiftInitGenerator */ = {
152 | isa = PBXGroup;
153 | children = (
154 | E4E82B4D21B041F9008124BE /* AppDelegate.swift */,
155 | E4E82B5121B041FA008124BE /* Assets.xcassets */,
156 | E4E82B5321B041FA008124BE /* Main.storyboard */,
157 | E4E82B5621B041FA008124BE /* Info.plist */,
158 | E4E82B5721B041FA008124BE /* SwiftInitGenerator.entitlements */,
159 | );
160 | path = SwiftInitGenerator;
161 | sourceTree = "";
162 | };
163 | E4E82B5F21B041FA008124BE /* SwiftInitGeneratorTests */ = {
164 | isa = PBXGroup;
165 | children = (
166 | E4E82B6021B041FA008124BE /* SwiftInitGeneratorTests.swift */,
167 | E4E82B6221B041FA008124BE /* Info.plist */,
168 | );
169 | path = SwiftInitGeneratorTests;
170 | sourceTree = "";
171 | };
172 | /* End PBXGroup section */
173 |
174 | /* Begin PBXNativeTarget section */
175 | E4D8F82321B0424300DF0B51 /* SourceEditorExtension */ = {
176 | isa = PBXNativeTarget;
177 | buildConfigurationList = E4D8F83421B0424300DF0B51 /* Build configuration list for PBXNativeTarget "SourceEditorExtension" */;
178 | buildPhases = (
179 | E4D8F82021B0424300DF0B51 /* Sources */,
180 | E4D8F82121B0424300DF0B51 /* Frameworks */,
181 | E4D8F82221B0424300DF0B51 /* Resources */,
182 | );
183 | buildRules = (
184 | );
185 | dependencies = (
186 | );
187 | name = SourceEditorExtension;
188 | productName = SourceEditorExtension;
189 | productReference = E4D8F82421B0424300DF0B51 /* Swift Init Generator.appex */;
190 | productType = "com.apple.product-type.xcode-extension";
191 | };
192 | E4E82B4921B041F9008124BE /* SwiftInitGenerator */ = {
193 | isa = PBXNativeTarget;
194 | buildConfigurationList = E4E82B6521B041FA008124BE /* Build configuration list for PBXNativeTarget "SwiftInitGenerator" */;
195 | buildPhases = (
196 | E4E82B4621B041F9008124BE /* Sources */,
197 | E4E82B4721B041F9008124BE /* Frameworks */,
198 | E4E82B4821B041F9008124BE /* Resources */,
199 | E4D8F83521B0424300DF0B51 /* Embed App Extensions */,
200 | );
201 | buildRules = (
202 | );
203 | dependencies = (
204 | E4D8F83021B0424300DF0B51 /* PBXTargetDependency */,
205 | );
206 | name = SwiftInitGenerator;
207 | productName = SwiftInitGenerator;
208 | productReference = E4E82B4A21B041F9008124BE /* SwiftInitGenerator.app */;
209 | productType = "com.apple.product-type.application";
210 | };
211 | E4E82B5B21B041FA008124BE /* SwiftInitGeneratorTests */ = {
212 | isa = PBXNativeTarget;
213 | buildConfigurationList = E4E82B6821B041FA008124BE /* Build configuration list for PBXNativeTarget "SwiftInitGeneratorTests" */;
214 | buildPhases = (
215 | E4E82B5821B041FA008124BE /* Sources */,
216 | E4E82B5921B041FA008124BE /* Frameworks */,
217 | E4E82B5A21B041FA008124BE /* Resources */,
218 | );
219 | buildRules = (
220 | );
221 | dependencies = (
222 | E4E82B5E21B041FA008124BE /* PBXTargetDependency */,
223 | );
224 | name = SwiftInitGeneratorTests;
225 | productName = SwiftInitGeneratorTests;
226 | productReference = E4E82B5C21B041FA008124BE /* SwiftInitGeneratorTests.xctest */;
227 | productType = "com.apple.product-type.bundle.unit-test";
228 | };
229 | /* End PBXNativeTarget section */
230 |
231 | /* Begin PBXProject section */
232 | E4E82B4221B041F9008124BE /* Project object */ = {
233 | isa = PBXProject;
234 | attributes = {
235 | LastSwiftUpdateCheck = 1010;
236 | LastUpgradeCheck = 1150;
237 | ORGANIZATIONNAME = atimca.com;
238 | TargetAttributes = {
239 | E4D8F82321B0424300DF0B51 = {
240 | CreatedOnToolsVersion = 10.1;
241 | LastSwiftMigration = 1100;
242 | };
243 | E4E82B4921B041F9008124BE = {
244 | CreatedOnToolsVersion = 10.1;
245 | LastSwiftMigration = 1100;
246 | };
247 | E4E82B5B21B041FA008124BE = {
248 | CreatedOnToolsVersion = 10.1;
249 | LastSwiftMigration = 1100;
250 | TestTargetID = E4E82B4921B041F9008124BE;
251 | };
252 | };
253 | };
254 | buildConfigurationList = E4E82B4521B041F9008124BE /* Build configuration list for PBXProject "SwiftInitGenerator" */;
255 | compatibilityVersion = "Xcode 9.3";
256 | developmentRegion = en;
257 | hasScannedForEncodings = 0;
258 | knownRegions = (
259 | en,
260 | Base,
261 | );
262 | mainGroup = E4E82B4121B041F9008124BE;
263 | productRefGroup = E4E82B4B21B041F9008124BE /* Products */;
264 | projectDirPath = "";
265 | projectRoot = "";
266 | targets = (
267 | E4E82B4921B041F9008124BE /* SwiftInitGenerator */,
268 | E4E82B5B21B041FA008124BE /* SwiftInitGeneratorTests */,
269 | E4D8F82321B0424300DF0B51 /* SourceEditorExtension */,
270 | );
271 | };
272 | /* End PBXProject section */
273 |
274 | /* Begin PBXResourcesBuildPhase section */
275 | E4D8F82221B0424300DF0B51 /* Resources */ = {
276 | isa = PBXResourcesBuildPhase;
277 | buildActionMask = 2147483647;
278 | files = (
279 | );
280 | runOnlyForDeploymentPostprocessing = 0;
281 | };
282 | E4E82B4821B041F9008124BE /* Resources */ = {
283 | isa = PBXResourcesBuildPhase;
284 | buildActionMask = 2147483647;
285 | files = (
286 | E4E82B5221B041FA008124BE /* Assets.xcassets in Resources */,
287 | E4E82B5521B041FA008124BE /* Main.storyboard in Resources */,
288 | );
289 | runOnlyForDeploymentPostprocessing = 0;
290 | };
291 | E4E82B5A21B041FA008124BE /* Resources */ = {
292 | isa = PBXResourcesBuildPhase;
293 | buildActionMask = 2147483647;
294 | files = (
295 | );
296 | runOnlyForDeploymentPostprocessing = 0;
297 | };
298 | /* End PBXResourcesBuildPhase section */
299 |
300 | /* Begin PBXSourcesBuildPhase section */
301 | E4D8F82021B0424300DF0B51 /* Sources */ = {
302 | isa = PBXSourcesBuildPhase;
303 | buildActionMask = 2147483647;
304 | files = (
305 | E4D8F83A21B0435200DF0B51 /* SourceEditorCommand.swift in Sources */,
306 | E4D8F83D21B0435200DF0B51 /* Generator.swift in Sources */,
307 | E4D8F83C21B0435200DF0B51 /* SourceEditorExtension.swift in Sources */,
308 | 64F47455232A6FBE009E69FC /* Variable.swift in Sources */,
309 | );
310 | runOnlyForDeploymentPostprocessing = 0;
311 | };
312 | E4E82B4621B041F9008124BE /* Sources */ = {
313 | isa = PBXSourcesBuildPhase;
314 | buildActionMask = 2147483647;
315 | files = (
316 | E4E82B4E21B041F9008124BE /* AppDelegate.swift in Sources */,
317 | );
318 | runOnlyForDeploymentPostprocessing = 0;
319 | };
320 | E4E82B5821B041FA008124BE /* Sources */ = {
321 | isa = PBXSourcesBuildPhase;
322 | buildActionMask = 2147483647;
323 | files = (
324 | E4E82B6121B041FA008124BE /* SwiftInitGeneratorTests.swift in Sources */,
325 | 64F47454232A6FBE009E69FC /* Variable.swift in Sources */,
326 | E4D8F83F21B0441200DF0B51 /* Generator.swift in Sources */,
327 | );
328 | runOnlyForDeploymentPostprocessing = 0;
329 | };
330 | /* End PBXSourcesBuildPhase section */
331 |
332 | /* Begin PBXTargetDependency section */
333 | E4D8F83021B0424300DF0B51 /* PBXTargetDependency */ = {
334 | isa = PBXTargetDependency;
335 | target = E4D8F82321B0424300DF0B51 /* SourceEditorExtension */;
336 | targetProxy = E4D8F82F21B0424300DF0B51 /* PBXContainerItemProxy */;
337 | };
338 | E4E82B5E21B041FA008124BE /* PBXTargetDependency */ = {
339 | isa = PBXTargetDependency;
340 | target = E4E82B4921B041F9008124BE /* SwiftInitGenerator */;
341 | targetProxy = E4E82B5D21B041FA008124BE /* PBXContainerItemProxy */;
342 | };
343 | /* End PBXTargetDependency section */
344 |
345 | /* Begin PBXVariantGroup section */
346 | E4E82B5321B041FA008124BE /* Main.storyboard */ = {
347 | isa = PBXVariantGroup;
348 | children = (
349 | E4E82B5421B041FA008124BE /* Base */,
350 | );
351 | name = Main.storyboard;
352 | sourceTree = "";
353 | };
354 | /* End PBXVariantGroup section */
355 |
356 | /* Begin XCBuildConfiguration section */
357 | E4D8F83221B0424300DF0B51 /* Debug */ = {
358 | isa = XCBuildConfiguration;
359 | buildSettings = {
360 | CLANG_ENABLE_MODULES = YES;
361 | CODE_SIGN_ENTITLEMENTS = SourceEditorExtension/SourceEditorExtension.entitlements;
362 | CODE_SIGN_IDENTITY = "-";
363 | CODE_SIGN_STYLE = Automatic;
364 | COMBINE_HIDPI_IMAGES = YES;
365 | DEVELOPMENT_TEAM = KSPVBX34L6;
366 | INFOPLIST_FILE = SourceEditorExtension/Info.plist;
367 | LD_RUNPATH_SEARCH_PATHS = (
368 | "$(inherited)",
369 | "@executable_path/../Frameworks",
370 | "@executable_path/../../../../Frameworks",
371 | );
372 | MARKETING_VERSION = 0.1.1;
373 | PRODUCT_BUNDLE_IDENTIFIER = atimca.com.SwiftInitGenerator.SourceEditorExtension;
374 | PRODUCT_NAME = "Swift Init Generator";
375 | SKIP_INSTALL = YES;
376 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
377 | SWIFT_VERSION = 5.0;
378 | };
379 | name = Debug;
380 | };
381 | E4D8F83321B0424300DF0B51 /* Release */ = {
382 | isa = XCBuildConfiguration;
383 | buildSettings = {
384 | CLANG_ENABLE_MODULES = YES;
385 | CODE_SIGN_ENTITLEMENTS = SourceEditorExtension/SourceEditorExtension.entitlements;
386 | CODE_SIGN_IDENTITY = "-";
387 | CODE_SIGN_STYLE = Automatic;
388 | COMBINE_HIDPI_IMAGES = YES;
389 | DEVELOPMENT_TEAM = KSPVBX34L6;
390 | INFOPLIST_FILE = SourceEditorExtension/Info.plist;
391 | LD_RUNPATH_SEARCH_PATHS = (
392 | "$(inherited)",
393 | "@executable_path/../Frameworks",
394 | "@executable_path/../../../../Frameworks",
395 | );
396 | MARKETING_VERSION = 0.1.1;
397 | PRODUCT_BUNDLE_IDENTIFIER = atimca.com.SwiftInitGenerator.SourceEditorExtension;
398 | PRODUCT_NAME = "Swift Init Generator";
399 | SKIP_INSTALL = YES;
400 | SWIFT_VERSION = 5.0;
401 | };
402 | name = Release;
403 | };
404 | E4E82B6321B041FA008124BE /* Debug */ = {
405 | isa = XCBuildConfiguration;
406 | buildSettings = {
407 | ALWAYS_SEARCH_USER_PATHS = NO;
408 | CLANG_ANALYZER_NONNULL = YES;
409 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
410 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
411 | CLANG_CXX_LIBRARY = "libc++";
412 | CLANG_ENABLE_MODULES = YES;
413 | CLANG_ENABLE_OBJC_ARC = YES;
414 | CLANG_ENABLE_OBJC_WEAK = YES;
415 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
416 | CLANG_WARN_BOOL_CONVERSION = YES;
417 | CLANG_WARN_COMMA = YES;
418 | CLANG_WARN_CONSTANT_CONVERSION = YES;
419 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
420 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
421 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
422 | CLANG_WARN_EMPTY_BODY = YES;
423 | CLANG_WARN_ENUM_CONVERSION = YES;
424 | CLANG_WARN_INFINITE_RECURSION = YES;
425 | CLANG_WARN_INT_CONVERSION = YES;
426 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
427 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
428 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
429 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
430 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
431 | CLANG_WARN_STRICT_PROTOTYPES = YES;
432 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
433 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
434 | CLANG_WARN_UNREACHABLE_CODE = YES;
435 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
436 | CODE_SIGN_IDENTITY = "Mac Developer";
437 | COPY_PHASE_STRIP = NO;
438 | DEBUG_INFORMATION_FORMAT = dwarf;
439 | ENABLE_STRICT_OBJC_MSGSEND = YES;
440 | ENABLE_TESTABILITY = YES;
441 | GCC_C_LANGUAGE_STANDARD = gnu11;
442 | GCC_DYNAMIC_NO_PIC = NO;
443 | GCC_NO_COMMON_BLOCKS = YES;
444 | GCC_OPTIMIZATION_LEVEL = 0;
445 | GCC_PREPROCESSOR_DEFINITIONS = (
446 | "DEBUG=1",
447 | "$(inherited)",
448 | );
449 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
450 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
451 | GCC_WARN_UNDECLARED_SELECTOR = YES;
452 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
453 | GCC_WARN_UNUSED_FUNCTION = YES;
454 | GCC_WARN_UNUSED_VARIABLE = YES;
455 | MACOSX_DEPLOYMENT_TARGET = 10.14;
456 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
457 | MTL_FAST_MATH = YES;
458 | ONLY_ACTIVE_ARCH = YES;
459 | SDKROOT = macosx;
460 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
461 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
462 | };
463 | name = Debug;
464 | };
465 | E4E82B6421B041FA008124BE /* Release */ = {
466 | isa = XCBuildConfiguration;
467 | buildSettings = {
468 | ALWAYS_SEARCH_USER_PATHS = NO;
469 | CLANG_ANALYZER_NONNULL = YES;
470 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
471 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
472 | CLANG_CXX_LIBRARY = "libc++";
473 | CLANG_ENABLE_MODULES = YES;
474 | CLANG_ENABLE_OBJC_ARC = YES;
475 | CLANG_ENABLE_OBJC_WEAK = YES;
476 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
477 | CLANG_WARN_BOOL_CONVERSION = YES;
478 | CLANG_WARN_COMMA = YES;
479 | CLANG_WARN_CONSTANT_CONVERSION = YES;
480 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
481 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
482 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
483 | CLANG_WARN_EMPTY_BODY = YES;
484 | CLANG_WARN_ENUM_CONVERSION = YES;
485 | CLANG_WARN_INFINITE_RECURSION = YES;
486 | CLANG_WARN_INT_CONVERSION = YES;
487 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
488 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
489 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
490 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
491 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
492 | CLANG_WARN_STRICT_PROTOTYPES = YES;
493 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
494 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
495 | CLANG_WARN_UNREACHABLE_CODE = YES;
496 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
497 | CODE_SIGN_IDENTITY = "Mac Developer";
498 | COPY_PHASE_STRIP = NO;
499 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
500 | ENABLE_NS_ASSERTIONS = NO;
501 | ENABLE_STRICT_OBJC_MSGSEND = YES;
502 | GCC_C_LANGUAGE_STANDARD = gnu11;
503 | GCC_NO_COMMON_BLOCKS = YES;
504 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
505 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
506 | GCC_WARN_UNDECLARED_SELECTOR = YES;
507 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
508 | GCC_WARN_UNUSED_FUNCTION = YES;
509 | GCC_WARN_UNUSED_VARIABLE = YES;
510 | MACOSX_DEPLOYMENT_TARGET = 10.14;
511 | MTL_ENABLE_DEBUG_INFO = NO;
512 | MTL_FAST_MATH = YES;
513 | SDKROOT = macosx;
514 | SWIFT_COMPILATION_MODE = wholemodule;
515 | SWIFT_OPTIMIZATION_LEVEL = "-O";
516 | };
517 | name = Release;
518 | };
519 | E4E82B6621B041FA008124BE /* Debug */ = {
520 | isa = XCBuildConfiguration;
521 | buildSettings = {
522 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
523 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
524 | CODE_SIGN_ENTITLEMENTS = SwiftInitGenerator/SwiftInitGenerator.entitlements;
525 | CODE_SIGN_IDENTITY = "-";
526 | CODE_SIGN_STYLE = Automatic;
527 | COMBINE_HIDPI_IMAGES = YES;
528 | DEVELOPMENT_TEAM = KSPVBX34L6;
529 | INFOPLIST_FILE = SwiftInitGenerator/Info.plist;
530 | LD_RUNPATH_SEARCH_PATHS = (
531 | "$(inherited)",
532 | "@executable_path/../Frameworks",
533 | );
534 | MARKETING_VERSION = 0.1.1;
535 | PRODUCT_BUNDLE_IDENTIFIER = atimca.com.SwiftInitGenerator;
536 | PRODUCT_NAME = SwiftInitGenerator;
537 | SWIFT_VERSION = 5.0;
538 | };
539 | name = Debug;
540 | };
541 | E4E82B6721B041FA008124BE /* Release */ = {
542 | isa = XCBuildConfiguration;
543 | buildSettings = {
544 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
545 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
546 | CODE_SIGN_ENTITLEMENTS = SwiftInitGenerator/SwiftInitGenerator.entitlements;
547 | CODE_SIGN_IDENTITY = "-";
548 | CODE_SIGN_STYLE = Automatic;
549 | COMBINE_HIDPI_IMAGES = YES;
550 | DEVELOPMENT_TEAM = KSPVBX34L6;
551 | INFOPLIST_FILE = SwiftInitGenerator/Info.plist;
552 | LD_RUNPATH_SEARCH_PATHS = (
553 | "$(inherited)",
554 | "@executable_path/../Frameworks",
555 | );
556 | MARKETING_VERSION = 0.1.1;
557 | PRODUCT_BUNDLE_IDENTIFIER = atimca.com.SwiftInitGenerator;
558 | PRODUCT_NAME = SwiftInitGenerator;
559 | SWIFT_VERSION = 5.0;
560 | };
561 | name = Release;
562 | };
563 | E4E82B6921B041FA008124BE /* Debug */ = {
564 | isa = XCBuildConfiguration;
565 | buildSettings = {
566 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
567 | BUNDLE_LOADER = "$(TEST_HOST)";
568 | CODE_SIGN_STYLE = Automatic;
569 | COMBINE_HIDPI_IMAGES = YES;
570 | DEVELOPMENT_TEAM = KSPVBX34L6;
571 | INFOPLIST_FILE = SwiftInitGeneratorTests/Info.plist;
572 | LD_RUNPATH_SEARCH_PATHS = (
573 | "$(inherited)",
574 | "@executable_path/../Frameworks",
575 | "@loader_path/../Frameworks",
576 | );
577 | PRODUCT_BUNDLE_IDENTIFIER = atimca.com.SwiftInitGeneratorTests;
578 | PRODUCT_NAME = "$(TARGET_NAME)";
579 | SWIFT_VERSION = 5.0;
580 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftInitGenerator.app/Contents/MacOS/SwiftInitGenerator";
581 | };
582 | name = Debug;
583 | };
584 | E4E82B6A21B041FA008124BE /* Release */ = {
585 | isa = XCBuildConfiguration;
586 | buildSettings = {
587 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
588 | BUNDLE_LOADER = "$(TEST_HOST)";
589 | CODE_SIGN_STYLE = Automatic;
590 | COMBINE_HIDPI_IMAGES = YES;
591 | DEVELOPMENT_TEAM = KSPVBX34L6;
592 | INFOPLIST_FILE = SwiftInitGeneratorTests/Info.plist;
593 | LD_RUNPATH_SEARCH_PATHS = (
594 | "$(inherited)",
595 | "@executable_path/../Frameworks",
596 | "@loader_path/../Frameworks",
597 | );
598 | PRODUCT_BUNDLE_IDENTIFIER = atimca.com.SwiftInitGeneratorTests;
599 | PRODUCT_NAME = "$(TARGET_NAME)";
600 | SWIFT_VERSION = 5.0;
601 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftInitGenerator.app/Contents/MacOS/SwiftInitGenerator";
602 | };
603 | name = Release;
604 | };
605 | /* End XCBuildConfiguration section */
606 |
607 | /* Begin XCConfigurationList section */
608 | E4D8F83421B0424300DF0B51 /* Build configuration list for PBXNativeTarget "SourceEditorExtension" */ = {
609 | isa = XCConfigurationList;
610 | buildConfigurations = (
611 | E4D8F83221B0424300DF0B51 /* Debug */,
612 | E4D8F83321B0424300DF0B51 /* Release */,
613 | );
614 | defaultConfigurationIsVisible = 0;
615 | defaultConfigurationName = Release;
616 | };
617 | E4E82B4521B041F9008124BE /* Build configuration list for PBXProject "SwiftInitGenerator" */ = {
618 | isa = XCConfigurationList;
619 | buildConfigurations = (
620 | E4E82B6321B041FA008124BE /* Debug */,
621 | E4E82B6421B041FA008124BE /* Release */,
622 | );
623 | defaultConfigurationIsVisible = 0;
624 | defaultConfigurationName = Release;
625 | };
626 | E4E82B6521B041FA008124BE /* Build configuration list for PBXNativeTarget "SwiftInitGenerator" */ = {
627 | isa = XCConfigurationList;
628 | buildConfigurations = (
629 | E4E82B6621B041FA008124BE /* Debug */,
630 | E4E82B6721B041FA008124BE /* Release */,
631 | );
632 | defaultConfigurationIsVisible = 0;
633 | defaultConfigurationName = Release;
634 | };
635 | E4E82B6821B041FA008124BE /* Build configuration list for PBXNativeTarget "SwiftInitGeneratorTests" */ = {
636 | isa = XCConfigurationList;
637 | buildConfigurations = (
638 | E4E82B6921B041FA008124BE /* Debug */,
639 | E4E82B6A21B041FA008124BE /* Release */,
640 | );
641 | defaultConfigurationIsVisible = 0;
642 | defaultConfigurationName = Release;
643 | };
644 | /* End XCConfigurationList section */
645 | };
646 | rootObject = E4E82B4221B041F9008124BE /* Project object */;
647 | }
648 |
--------------------------------------------------------------------------------
/SwiftInitGenerator.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/SwiftInitGenerator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/SwiftInitGenerator.xcodeproj/xcshareddata/xcschemes/SourceEditorExtension.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
6 |
9 |
10 |
16 |
22 |
23 |
24 |
30 |
36 |
37 |
38 |
39 |
40 |
45 |
46 |
48 |
54 |
55 |
56 |
57 |
58 |
70 |
72 |
78 |
79 |
80 |
81 |
88 |
90 |
96 |
97 |
98 |
99 |
101 |
102 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/SwiftInitGenerator.xcodeproj/xcshareddata/xcschemes/SwiftInitGenerator.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/SwiftInitGenerator/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Smirnov Maxim on 29/11/2018.
3 | // Copyright © 2018 Smirnov Maxim. All rights reserved.
4 | //
5 |
6 | import Cocoa
7 |
8 | @NSApplicationMain
9 | class AppDelegate: NSObject, NSApplicationDelegate { }
10 |
--------------------------------------------------------------------------------
/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "Icon-16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "Icon-32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "Icon-32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "Icon-64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "Icon-128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "Icon-256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "Icon-256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "Icon-512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "Icon-512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "Icon-1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-1024.png
--------------------------------------------------------------------------------
/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-128.png
--------------------------------------------------------------------------------
/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-16.png
--------------------------------------------------------------------------------
/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-256.png
--------------------------------------------------------------------------------
/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-32.png
--------------------------------------------------------------------------------
/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-512.png
--------------------------------------------------------------------------------
/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/atimca/SwiftInitGenerator/989cb8f8f9112ee4a31a2897c6fc933c705c0922/SwiftInitGenerator/Assets.xcassets/AppIcon.appiconset/Icon-64.png
--------------------------------------------------------------------------------
/SwiftInitGenerator/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/SwiftInitGenerator/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
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 | Cg
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 | Cg
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | Cg
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 | folder.
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 | Cg
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 | Cg
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 | Cg
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 |
--------------------------------------------------------------------------------
/SwiftInitGenerator/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
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 | $(MARKETING_VERSION)
21 | CFBundleVersion
22 | 1
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | Copyright © 2018 Smirnov Maxim All rights reserved.
27 | NSMainStoryboardFile
28 | Main
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/SwiftInitGenerator/SwiftInitGenerator.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.files.user-selected.read-only
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/SwiftInitGeneratorTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/SwiftInitGeneratorTests/SwiftInitGeneratorTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Smirnov Maxim on 29/11/2018.
3 | // Copyright © 2018 Smirnov Maxim. All rights reserved.
4 | //
5 |
6 | import XCTest
7 |
8 | class SwiftInitializerGeneratorTests: XCTestCase {
9 |
10 | func assert(input: [String], output: [String], file: StaticString = #file, line: UInt = #line) {
11 | let lines = Generator.generate(selection: input, indentation: " ", leadingIndent: "")
12 | if(lines != output) {
13 | XCTFail("Output is not correct; expected:\n\(output.joined(separator: "\n"))\n\ngot:\n\(lines.joined(separator: "\n"))",
14 | file: file,
15 | line: line)
16 | }
17 | }
18 |
19 | func testNoAccessModifiers() {
20 | assert(
21 | input: [
22 | "let a: Int",
23 | "let b: Int"
24 | ],
25 | output: [
26 | "public init(a: Int, b: Int) {",
27 | " self.a = a",
28 | " self.b = b",
29 | "}"
30 | ])
31 | }
32 |
33 | func testNoProperties() {
34 | assert(
35 | input: [
36 | "",
37 | ""
38 | ],
39 | output: [
40 | "public init() { }"
41 | ])
42 | }
43 |
44 | func testEmptyLineInBetween() {
45 | assert(
46 | input: [
47 | "let a: Int",
48 | "",
49 | "let b: Int"
50 | ],
51 | output: [
52 | "public init(a: Int, b: Int) {",
53 | " self.a = a",
54 | " self.b = b",
55 | "}"
56 | ])
57 | }
58 |
59 | func testSingleAccessModifier() {
60 | assert(
61 | input: [
62 | "internal let a: Int",
63 | "private let b: Int"
64 | ],
65 | output: [
66 | "public init(a: Int, b: Int) {",
67 | " self.a = a",
68 | " self.b = b",
69 | "}"
70 | ])
71 | }
72 |
73 | func testDoubleAccessModifier() {
74 | assert(
75 | input: [
76 | "public internal(set) let a: Int",
77 | "public private(set) let b: Int"
78 | ],
79 | output: [
80 | "public init(a: Int, b: Int) {",
81 | " self.a = a",
82 | " self.b = b",
83 | "}"
84 | ])
85 | }
86 |
87 |
88 | func testCommentLine() {
89 | assert(
90 | input: [
91 | "/// a very important property",
92 | "let a: Int",
93 | "// this one, not so much",
94 | "let b: Int",
95 | "/*",
96 | " * pay attention to this one",
97 | " */",
98 | "/*",
99 | "let b: Int",
100 | " */",
101 | "let c: IBOutlet!"
102 | ],
103 | output: [
104 | "public init(a: Int, b: Int, c: IBOutlet!) {",
105 | " self.a = a",
106 | " self.b = b",
107 | " self.c = c",
108 | "}"
109 | ])
110 | }
111 |
112 | func testDynamicVar() {
113 | assert(
114 | input: ["dynamic var hello: String",
115 | "dynamic var a: Int?",
116 | "var b: Float"],
117 | output: [
118 | "public init(hello: String, a: Int?, b: Float) {",
119 | " self.hello = hello",
120 | " self.a = a",
121 | " self.b = b",
122 | "}"
123 | ])
124 | }
125 |
126 | func testEscapingClosure() {
127 | assert(
128 | input: [
129 | "let a: (String) -> Int?",
130 | "let b: () -> () -> Void",
131 | "let c: ((String, Int))->()",
132 | ],
133 | output: [
134 | "public init(a: @escaping (String) -> Int?,",
135 | " b: @escaping () -> () -> Void,",
136 | " c: @escaping ((String, Int))->()) {",
137 | " self.a = a",
138 | " self.b = b",
139 | " self.c = c",
140 | "}"
141 | ])
142 | }
143 |
144 | func testNoEscapingAttribute() {
145 | assert(
146 | input: [
147 | "let a: (() -> Void)?",
148 | "let b: [() -> Void]",
149 | "let c: (()->())!"
150 | ],
151 | output: [
152 | "public init(a: (() -> Void)?, b: [() -> Void], c: (()->())!) {",
153 | " self.a = a",
154 | " self.b = b",
155 | " self.c = c",
156 | "}"
157 | ])
158 | }
159 |
160 | func testUnderscoredWillRemoveFromInitMethod() {
161 | assert(
162 | input: [
163 | "private let _a: Int",
164 | "let b: Int"
165 | ],
166 | output: [
167 | "public init(a: Int, b: Int) {",
168 | " _a = a",
169 | " self.b = b",
170 | "}"
171 | ])
172 | }
173 |
174 | func testForExcludingImutablesPropertiesWithDefaultValue() {
175 | assert(
176 | input: [
177 | "let a: Int = 5"
178 | ],
179 | output: [
180 | "public init() { }"
181 | ])
182 | }
183 |
184 | func testForExcludingImutablesPropertiesWithDefaultValueAndKeepsOthers() {
185 | assert(
186 | input: [
187 | "let a: Int = 5",
188 | "let b: Int",
189 | "var c: Int"
190 | ],
191 | output: [
192 | "public init(b: Int, c: Int) {",
193 | " self.b = b",
194 | " self.c = c",
195 | "}"
196 | ])
197 | }
198 |
199 | func testInOneValueCase() {
200 | assert(
201 | input: [
202 | "let a: Int"
203 | ],
204 | output: [
205 | "public init(a: Int) {",
206 | " self.a = a",
207 | "}"
208 | ])
209 | }
210 |
211 | func testForSkippingComputedProperties() {
212 | assert(
213 | input: [
214 | "var a: Int {",
215 | " return 5 ",
216 | "}",
217 | "let b: Int",
218 | "var c: Int"
219 | ],
220 | output: [
221 | "public init(b: Int, c: Int) {",
222 | " self.b = b",
223 | " self.c = c",
224 | "}"
225 | ])
226 | }
227 |
228 | func testPrivateSetWillBeInTheInit() {
229 | assert(
230 | input: [
231 | "let a: Int",
232 | "private(set) var nom: String"
233 | ],
234 | output: [
235 | "public init(a: Int, nom: String) {",
236 | " self.a = a",
237 | " self.nom = nom",
238 | "}"
239 | ])
240 | }
241 | }
242 |
--------------------------------------------------------------------------------