├── Assets
├── Shortcut.png
└── ViewControllerExample.gif
├── DeclareType.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── project.pbxproj
├── DeclareTypeExtension
├── DeclareTypeExtension.entitlements
├── NSArrayExtension.swift
├── SequenceExtension.swift
├── SourceEditorExtension.swift
├── Info.plist
└── SourceEditorCommand.swift
├── .gitignore
├── DeclareType
├── AppDelegate.swift
├── Info.plist
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
└── Base.lproj
│ └── MainMenu.xib
├── LICENSE
└── README.md
/Assets/Shortcut.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/timaktimak/DeclareType/HEAD/Assets/Shortcut.png
--------------------------------------------------------------------------------
/Assets/ViewControllerExample.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/timaktimak/DeclareType/HEAD/Assets/ViewControllerExample.gif
--------------------------------------------------------------------------------
/DeclareType.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/DeclareTypeExtension/DeclareTypeExtension.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/DeclareTypeExtension/NSArrayExtension.swift:
--------------------------------------------------------------------------------
1 | //
2 | // NSArrayExtension.swift
3 | // DeclareTypeExtension
4 | //
5 | // Created by Timur Galimov on 23/12/2016.
6 | // Copyright © 2016 Timur Galimov. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | extension NSArray {
12 |
13 | func safeObject(atIndex index: Int) -> Any? {
14 | if index < count {
15 | return self[index]
16 | }
17 | return nil
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Mac OS X
2 | .DS_Store
3 |
4 | # Xcode
5 |
6 | ## Build generated
7 | build/
8 | DerivedData
9 |
10 | ## Various settings
11 | *.pbxuser
12 | !default.pbxuser
13 | *.mode1v3
14 | !default.mode1v3
15 | *.mode2v3
16 | !default.mode2v3
17 | *.perspectivev3
18 | !default.perspectivev3
19 | xcuserdata
20 |
21 | ## Other
22 | *.xccheckout
23 | *.moved-aside
24 | *.xcuserstate
25 | *.xcscmblueprint
26 |
27 | ## Obj-C/Swift specific
28 | *.hmap
29 | *.ipa
30 |
31 | ## Playgrounds
32 | timeline.xctimeline
33 | playground.xcworkspace
34 |
35 | # Swift Package Manager
36 | .build/
37 |
38 | # Carthage
39 | Carthage/Build
40 |
--------------------------------------------------------------------------------
/DeclareType/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // DeclareType
4 | //
5 | // Created by Timur Galimov on 23/12/2016.
6 | // Copyright © 2016 Timur Galimov. All rights reserved.
7 | //
8 |
9 | import Cocoa
10 |
11 | @NSApplicationMain
12 | class AppDelegate: NSObject, NSApplicationDelegate {
13 |
14 | @IBOutlet weak var window: NSWindow!
15 |
16 |
17 | func applicationDidFinishLaunching(_ aNotification: Notification) {
18 | // Insert code here to initialize your application
19 | }
20 |
21 | func applicationWillTerminate(_ aNotification: Notification) {
22 | // Insert code here to tear down your application
23 | }
24 |
25 |
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/DeclareTypeExtension/SequenceExtension.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SequenceExtension.swift
3 | // DeclareTypeExtension
4 | //
5 | // Created by Timur Galimov on 23/12/2016.
6 | // Copyright © 2016 Timur Galimov. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | extension Sequence {
12 |
13 | func findFirstOccurence(_ block: (Iterator.Element) -> Bool) -> Iterator.Element? {
14 | for x in self where block(x) {
15 | return x
16 | }
17 | return nil
18 | }
19 |
20 | func some(_ block: (Iterator.Element) -> Bool) -> Bool {
21 | return findFirstOccurence(block) != nil
22 | }
23 |
24 | func all(_ block: (Iterator.Element) -> Bool) -> Bool {
25 | return findFirstOccurence { !block($0) } == nil
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/DeclareTypeExtension/SourceEditorExtension.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SourceEditorExtension.swift
3 | // DeclareTypeExtension
4 | //
5 | // Created by Timur Galimov on 23/12/2016.
6 | // Copyright © 2016 Timur Galimov. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import XcodeKit
11 |
12 | class SourceEditorExtension: NSObject, XCSourceEditorExtension {
13 |
14 | /*
15 | func extensionDidFinishLaunching() {
16 | // If your extension needs to do any work at launch, implement this optional method.
17 | }
18 | */
19 |
20 | /*
21 | var commandDefinitions: [[XCSourceEditorCommandDefinitionKey: Any]] {
22 | // If your extension needs to return a collection of command definitions that differs from those in its Info.plist, implement this optional property getter.
23 | return []
24 | }
25 | */
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Timur Galimov
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 |
--------------------------------------------------------------------------------
/DeclareType/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleVersion
22 | 1
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | Copyright © 2016 Timur Galimov. All rights reserved.
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/DeclareType/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 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DeclareType
2 | An Xcode Source Editor Extension that generates a type declaration based on the file name
3 |
4 | 
5 |
6 |
7 | ## Why?
8 |
9 | Because typing the class name or choosing a Cocoa Touch Class template and selecting the superclass can be tedious.
10 |
11 | ## Installation
12 |
13 | 1. Open ``DeclareType.xcodeproj``
14 | 2. Enable target signing for both the Application and the Source Code Extension using your own developer ID
15 | 3. Select the application target and then Product > Archive
16 | 4. Export the archive as a macOS App
17 | 5. Run the app, then quit (Don't delete the app, put it in a convenient folder)
18 | 6. Go to System Preferences -> Extensions -> Xcode Source Editor and make sure the extension is enabled
19 | 7. The menu-item should now be available from Xcode's Editor menu
20 |
21 | ## Features
22 | - Detects probable superclass (or that a protocol is created) based on the file name ending
23 | - Imports UIKit it wasn't imported and a UIKit class is being created
24 | - Detects: UIView, UIViewController, UIButton, UITableView, UITableViewCell, UICollectionView, UICollectionViewCell
25 | - Creates a protocol if the file name ends with "able" or "Protocol"
26 | - Will create a class with no parent if no candidate was found
27 |
28 | ## Shortcut
29 | Preferences (⌘ + ,) -> Key Bindings -> Search for "Declare"
30 | 
31 |
32 | ## Limitations
33 | Detects superclasses only for UIKit classes. Works only with Swift.
34 |
--------------------------------------------------------------------------------
/DeclareTypeExtension/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | DeclareTypeExtension
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | XPC!
19 | CFBundleShortVersionString
20 | 1.0
21 | 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 | Declare type in empty file
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 © 2016 Timur Galimov. All rights reserved.
48 |
49 |
50 |
--------------------------------------------------------------------------------
/DeclareTypeExtension/SourceEditorCommand.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SourceEditorCommand.swift
3 | // DeclareTypeExtension
4 | //
5 | // Created by Timur Galimov on 23/12/2016.
6 | // Copyright © 2016 Timur Galimov. All rights reserved.
7 | //
8 |
9 | import Foundation
10 | import XcodeKit
11 |
12 | private enum UIKitClass: String {
13 | case view = "UIView"
14 | case button = "UIButton"
15 | case viewController = "UIViewController"
16 | case tableView = "UITableView"
17 | case tableViewCell = "UITableViewCell"
18 | case collectionView = "UICollectionView"
19 | case collectionViewCell = "UICollectionViewCell"
20 |
21 | var detectedEndings: [String] {
22 | switch self {
23 | case .view:
24 | return ["View", "view"]
25 | case .button:
26 | return ["Button", "button"]
27 | case .viewController:
28 | return ["Controller"]
29 | case .tableView:
30 | return ["TableView"]
31 | case .tableViewCell:
32 | return ["Cell"]
33 | case .collectionView:
34 | return ["CollectionView"]
35 | case .collectionViewCell:
36 | return ["CollectionViewCell", "CollectionCell"]
37 | }
38 | }
39 |
40 | static func detectSuperclass(forTypeName name: String) -> UIKitClass? {
41 | // check tableViewCell after collectionViewCell to give it a chance to be detected
42 | let candidates: [UIKitClass] = [.view, .button, .viewController, .tableView,
43 | .collectionViewCell, .collectionView, .tableViewCell]
44 | return candidates.findFirstOccurence {
45 | return $0.detectedEndings.findFirstOccurence { name.hasSuffix($0) } != nil
46 | }
47 | }
48 | }
49 |
50 | private enum Type {
51 |
52 | case classType(parentType: UIKitClass?)
53 | case structType
54 | case enumType
55 | case protocolType
56 |
57 | static func propableType(forFileName name: String) -> Type {
58 |
59 | if let detectedClass = UIKitClass.detectSuperclass(forTypeName: name) {
60 | return .classType(parentType: detectedClass)
61 | }
62 |
63 | if name.hasSuffix("Protocol") || name.hasSuffix("able") {
64 | return .protocolType
65 | }
66 |
67 | return .classType(parentType: nil)
68 | }
69 |
70 | func declarationCode(forTypeName name: String, tabWidth: Int) -> String? {
71 | let s: String? = {
72 | switch self {
73 | case .classType(parentType: let type):
74 | return "class \(name)" + (type.map { ": \($0.rawValue)" } ?? "")
75 | case .protocolType:
76 | return "protocol \(name) "
77 | default:
78 | return nil
79 | }
80 | }()
81 | return s.map { "\n" + $0 + " {\n\(String(repeating: " ", count: tabWidth))\n}" }
82 | }
83 | }
84 |
85 |
86 |
87 | class SourceEditorCommand: NSObject, XCSourceEditorCommand {
88 |
89 | private func setCursor(atLine line: Int, column: Int, invocation: XCSourceEditorCommandInvocation) {
90 | let range = XCSourceTextRange()
91 | let position = XCSourceTextPosition(line: line, column: column)
92 | range.start = position
93 | range.end = position
94 | invocation.buffer.selections.setArray([range])
95 | }
96 |
97 | private func trimEmptyLinesAtTheEnd(_ invocation: XCSourceEditorCommandInvocation) {
98 | while (invocation.buffer.lines.lastObject as? String)?.trimmingCharacters(in: .whitespacesAndNewlines) == "" {
99 | invocation.buffer.lines.removeLastObject()
100 | }
101 | }
102 |
103 | private func lineHasDeclaration(_ line: String) -> Bool {
104 | let line = line.trimmingCharacters(in: .whitespacesAndNewlines)
105 | let declarations = ["class", "struct", "enum", "protocol", "extension", "func", "var", "let"]
106 | return declarations.some { line.hasPrefix($0) }
107 | }
108 |
109 | private func lineHasUIKitImport(_ line: String) -> Bool {
110 | return line.trimmingCharacters(in: .whitespacesAndNewlines) == "import UIKit"
111 | }
112 |
113 | // "// Classname.swift" -> "Classname"
114 | private func fileName(fromFileNameComment comment: String) -> String? {
115 |
116 | let comment = comment.trimmingCharacters(in: .whitespacesAndNewlines)
117 |
118 | let commentPrefix = "//"
119 | guard comment.hasPrefix(commentPrefix) else { return nil }
120 |
121 | let swiftExtensionSuffix = ".swift"
122 | guard comment.hasSuffix(swiftExtensionSuffix) else { return nil }
123 |
124 | let startIndex = comment.index(comment.startIndex, offsetBy: commentPrefix.characters.count)
125 | let endIndex = comment.index(comment.endIndex, offsetBy: -swiftExtensionSuffix.characters.count)
126 |
127 | return comment[startIndex.. Void ) -> Void {
131 |
132 | defer { completionHandler(nil) } // showing an error feels ugly, just do nothing in case of an error
133 |
134 | guard invocation.buffer.contentUTI == "public.swift-source" else { return }
135 | guard let secondLine = invocation.buffer.lines.safeObject(atIndex: 1) as? String else { return }
136 | guard let fileName = fileName(fromFileNameComment: secondLine) else { return }
137 | guard fileName.rangeOfCharacter(from: CharacterSet.letters.inverted) == nil else { return }
138 | guard invocation.buffer.lines.all({ !lineHasDeclaration($0 as? String ?? "") }) else { return }
139 |
140 | let type = Type.propableType(forFileName: fileName)
141 | if let code = type.declarationCode(forTypeName: fileName, tabWidth: invocation.buffer.tabWidth) {
142 |
143 | trimEmptyLinesAtTheEnd(invocation)
144 |
145 | switch type {
146 | case .classType(parentType: let parentType) where parentType != nil:
147 | if invocation.buffer.lines.all({ !lineHasUIKitImport($0 as? String ?? "") }) {
148 | invocation.buffer.lines.add("import UIKit\n")
149 | }
150 | default:
151 | break
152 | }
153 |
154 | invocation.buffer.lines.add(code)
155 | setCursor(atLine: invocation.buffer.lines.count - 2, column: invocation.buffer.tabWidth, invocation: invocation)
156 | }
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/DeclareType.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 8234EC0A1E0C892B001AEDB1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8234EC091E0C892B001AEDB1 /* AppDelegate.swift */; };
11 | 8234EC0C1E0C892B001AEDB1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8234EC0B1E0C892B001AEDB1 /* Assets.xcassets */; };
12 | 8234EC0F1E0C892B001AEDB1 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 8234EC0D1E0C892B001AEDB1 /* MainMenu.xib */; };
13 | 8234EC1D1E0C8BCE001AEDB1 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8234EC1C1E0C8BCE001AEDB1 /* Cocoa.framework */; };
14 | 8234EC221E0C8BCE001AEDB1 /* SourceEditorExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8234EC211E0C8BCE001AEDB1 /* SourceEditorExtension.swift */; };
15 | 8234EC241E0C8BCE001AEDB1 /* SourceEditorCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8234EC231E0C8BCE001AEDB1 /* SourceEditorCommand.swift */; };
16 | 8234EC281E0C8BCE001AEDB1 /* DeclareTypeExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 8234EC1A1E0C8BCE001AEDB1 /* DeclareTypeExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
17 | 8234EC2F1E0C8CB5001AEDB1 /* NSArrayExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8234EC2D1E0C8CB5001AEDB1 /* NSArrayExtension.swift */; };
18 | 8234EC301E0C8CB5001AEDB1 /* SequenceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8234EC2E1E0C8CB5001AEDB1 /* SequenceExtension.swift */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXContainerItemProxy section */
22 | 8234EC261E0C8BCE001AEDB1 /* PBXContainerItemProxy */ = {
23 | isa = PBXContainerItemProxy;
24 | containerPortal = 8234EBFE1E0C892B001AEDB1 /* Project object */;
25 | proxyType = 1;
26 | remoteGlobalIDString = 8234EC191E0C8BCE001AEDB1;
27 | remoteInfo = DeclareTypeExtension;
28 | };
29 | /* End PBXContainerItemProxy section */
30 |
31 | /* Begin PBXCopyFilesBuildPhase section */
32 | 8234EC2C1E0C8BCE001AEDB1 /* Embed App Extensions */ = {
33 | isa = PBXCopyFilesBuildPhase;
34 | buildActionMask = 2147483647;
35 | dstPath = "";
36 | dstSubfolderSpec = 13;
37 | files = (
38 | 8234EC281E0C8BCE001AEDB1 /* DeclareTypeExtension.appex in Embed App Extensions */,
39 | );
40 | name = "Embed App Extensions";
41 | runOnlyForDeploymentPostprocessing = 0;
42 | };
43 | /* End PBXCopyFilesBuildPhase section */
44 |
45 | /* Begin PBXFileReference section */
46 | 8234EC061E0C892B001AEDB1 /* DeclareType.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeclareType.app; sourceTree = BUILT_PRODUCTS_DIR; };
47 | 8234EC091E0C892B001AEDB1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
48 | 8234EC0B1E0C892B001AEDB1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
49 | 8234EC0E1E0C892B001AEDB1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; };
50 | 8234EC101E0C892B001AEDB1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
51 | 8234EC1A1E0C8BCE001AEDB1 /* DeclareTypeExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = DeclareTypeExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
52 | 8234EC1C1E0C8BCE001AEDB1 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
53 | 8234EC201E0C8BCE001AEDB1 /* DeclareTypeExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DeclareTypeExtension.entitlements; sourceTree = ""; };
54 | 8234EC211E0C8BCE001AEDB1 /* SourceEditorExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceEditorExtension.swift; sourceTree = ""; };
55 | 8234EC231E0C8BCE001AEDB1 /* SourceEditorCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceEditorCommand.swift; sourceTree = ""; };
56 | 8234EC251E0C8BCE001AEDB1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
57 | 8234EC2D1E0C8CB5001AEDB1 /* NSArrayExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSArrayExtension.swift; sourceTree = ""; };
58 | 8234EC2E1E0C8CB5001AEDB1 /* SequenceExtension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SequenceExtension.swift; sourceTree = ""; };
59 | /* End PBXFileReference section */
60 |
61 | /* Begin PBXFrameworksBuildPhase section */
62 | 8234EC031E0C892B001AEDB1 /* Frameworks */ = {
63 | isa = PBXFrameworksBuildPhase;
64 | buildActionMask = 2147483647;
65 | files = (
66 | );
67 | runOnlyForDeploymentPostprocessing = 0;
68 | };
69 | 8234EC171E0C8BCE001AEDB1 /* Frameworks */ = {
70 | isa = PBXFrameworksBuildPhase;
71 | buildActionMask = 2147483647;
72 | files = (
73 | 8234EC1D1E0C8BCE001AEDB1 /* Cocoa.framework in Frameworks */,
74 | );
75 | runOnlyForDeploymentPostprocessing = 0;
76 | };
77 | /* End PBXFrameworksBuildPhase section */
78 |
79 | /* Begin PBXGroup section */
80 | 8234EBFD1E0C892B001AEDB1 = {
81 | isa = PBXGroup;
82 | children = (
83 | 8234EC081E0C892B001AEDB1 /* DeclareType */,
84 | 8234EC1E1E0C8BCE001AEDB1 /* DeclareTypeExtension */,
85 | 8234EC1B1E0C8BCE001AEDB1 /* Frameworks */,
86 | 8234EC071E0C892B001AEDB1 /* Products */,
87 | );
88 | sourceTree = "";
89 | };
90 | 8234EC071E0C892B001AEDB1 /* Products */ = {
91 | isa = PBXGroup;
92 | children = (
93 | 8234EC061E0C892B001AEDB1 /* DeclareType.app */,
94 | 8234EC1A1E0C8BCE001AEDB1 /* DeclareTypeExtension.appex */,
95 | );
96 | name = Products;
97 | sourceTree = "";
98 | };
99 | 8234EC081E0C892B001AEDB1 /* DeclareType */ = {
100 | isa = PBXGroup;
101 | children = (
102 | 8234EC091E0C892B001AEDB1 /* AppDelegate.swift */,
103 | 8234EC0B1E0C892B001AEDB1 /* Assets.xcassets */,
104 | 8234EC0D1E0C892B001AEDB1 /* MainMenu.xib */,
105 | 8234EC101E0C892B001AEDB1 /* Info.plist */,
106 | );
107 | path = DeclareType;
108 | sourceTree = "";
109 | };
110 | 8234EC1B1E0C8BCE001AEDB1 /* Frameworks */ = {
111 | isa = PBXGroup;
112 | children = (
113 | 8234EC1C1E0C8BCE001AEDB1 /* Cocoa.framework */,
114 | );
115 | name = Frameworks;
116 | sourceTree = "";
117 | };
118 | 8234EC1E1E0C8BCE001AEDB1 /* DeclareTypeExtension */ = {
119 | isa = PBXGroup;
120 | children = (
121 | 8234EC2D1E0C8CB5001AEDB1 /* NSArrayExtension.swift */,
122 | 8234EC2E1E0C8CB5001AEDB1 /* SequenceExtension.swift */,
123 | 8234EC211E0C8BCE001AEDB1 /* SourceEditorExtension.swift */,
124 | 8234EC231E0C8BCE001AEDB1 /* SourceEditorCommand.swift */,
125 | 8234EC251E0C8BCE001AEDB1 /* Info.plist */,
126 | 8234EC1F1E0C8BCE001AEDB1 /* Supporting Files */,
127 | );
128 | path = DeclareTypeExtension;
129 | sourceTree = "";
130 | };
131 | 8234EC1F1E0C8BCE001AEDB1 /* Supporting Files */ = {
132 | isa = PBXGroup;
133 | children = (
134 | 8234EC201E0C8BCE001AEDB1 /* DeclareTypeExtension.entitlements */,
135 | );
136 | name = "Supporting Files";
137 | sourceTree = "";
138 | };
139 | /* End PBXGroup section */
140 |
141 | /* Begin PBXNativeTarget section */
142 | 8234EC051E0C892B001AEDB1 /* DeclareType */ = {
143 | isa = PBXNativeTarget;
144 | buildConfigurationList = 8234EC131E0C892B001AEDB1 /* Build configuration list for PBXNativeTarget "DeclareType" */;
145 | buildPhases = (
146 | 8234EC021E0C892B001AEDB1 /* Sources */,
147 | 8234EC031E0C892B001AEDB1 /* Frameworks */,
148 | 8234EC041E0C892B001AEDB1 /* Resources */,
149 | 8234EC2C1E0C8BCE001AEDB1 /* Embed App Extensions */,
150 | );
151 | buildRules = (
152 | );
153 | dependencies = (
154 | 8234EC271E0C8BCE001AEDB1 /* PBXTargetDependency */,
155 | );
156 | name = DeclareType;
157 | productName = DeclareType;
158 | productReference = 8234EC061E0C892B001AEDB1 /* DeclareType.app */;
159 | productType = "com.apple.product-type.application";
160 | };
161 | 8234EC191E0C8BCE001AEDB1 /* DeclareTypeExtension */ = {
162 | isa = PBXNativeTarget;
163 | buildConfigurationList = 8234EC2B1E0C8BCE001AEDB1 /* Build configuration list for PBXNativeTarget "DeclareTypeExtension" */;
164 | buildPhases = (
165 | 8234EC161E0C8BCE001AEDB1 /* Sources */,
166 | 8234EC171E0C8BCE001AEDB1 /* Frameworks */,
167 | 8234EC181E0C8BCE001AEDB1 /* Resources */,
168 | );
169 | buildRules = (
170 | );
171 | dependencies = (
172 | );
173 | name = DeclareTypeExtension;
174 | productName = DeclareTypeExtension;
175 | productReference = 8234EC1A1E0C8BCE001AEDB1 /* DeclareTypeExtension.appex */;
176 | productType = "com.apple.product-type.xcode-extension";
177 | };
178 | /* End PBXNativeTarget section */
179 |
180 | /* Begin PBXProject section */
181 | 8234EBFE1E0C892B001AEDB1 /* Project object */ = {
182 | isa = PBXProject;
183 | attributes = {
184 | LastSwiftUpdateCheck = 0810;
185 | LastUpgradeCheck = 0810;
186 | ORGANIZATIONNAME = "Timur Galimov";
187 | TargetAttributes = {
188 | 8234EC051E0C892B001AEDB1 = {
189 | CreatedOnToolsVersion = 8.1;
190 | DevelopmentTeam = 34BUG46ZSN;
191 | ProvisioningStyle = Automatic;
192 | };
193 | 8234EC191E0C8BCE001AEDB1 = {
194 | CreatedOnToolsVersion = 8.1;
195 | DevelopmentTeam = 34BUG46ZSN;
196 | ProvisioningStyle = Automatic;
197 | };
198 | };
199 | };
200 | buildConfigurationList = 8234EC011E0C892B001AEDB1 /* Build configuration list for PBXProject "DeclareType" */;
201 | compatibilityVersion = "Xcode 3.2";
202 | developmentRegion = English;
203 | hasScannedForEncodings = 0;
204 | knownRegions = (
205 | en,
206 | Base,
207 | );
208 | mainGroup = 8234EBFD1E0C892B001AEDB1;
209 | productRefGroup = 8234EC071E0C892B001AEDB1 /* Products */;
210 | projectDirPath = "";
211 | projectRoot = "";
212 | targets = (
213 | 8234EC051E0C892B001AEDB1 /* DeclareType */,
214 | 8234EC191E0C8BCE001AEDB1 /* DeclareTypeExtension */,
215 | );
216 | };
217 | /* End PBXProject section */
218 |
219 | /* Begin PBXResourcesBuildPhase section */
220 | 8234EC041E0C892B001AEDB1 /* Resources */ = {
221 | isa = PBXResourcesBuildPhase;
222 | buildActionMask = 2147483647;
223 | files = (
224 | 8234EC0C1E0C892B001AEDB1 /* Assets.xcassets in Resources */,
225 | 8234EC0F1E0C892B001AEDB1 /* MainMenu.xib in Resources */,
226 | );
227 | runOnlyForDeploymentPostprocessing = 0;
228 | };
229 | 8234EC181E0C8BCE001AEDB1 /* Resources */ = {
230 | isa = PBXResourcesBuildPhase;
231 | buildActionMask = 2147483647;
232 | files = (
233 | );
234 | runOnlyForDeploymentPostprocessing = 0;
235 | };
236 | /* End PBXResourcesBuildPhase section */
237 |
238 | /* Begin PBXSourcesBuildPhase section */
239 | 8234EC021E0C892B001AEDB1 /* Sources */ = {
240 | isa = PBXSourcesBuildPhase;
241 | buildActionMask = 2147483647;
242 | files = (
243 | 8234EC0A1E0C892B001AEDB1 /* AppDelegate.swift in Sources */,
244 | );
245 | runOnlyForDeploymentPostprocessing = 0;
246 | };
247 | 8234EC161E0C8BCE001AEDB1 /* Sources */ = {
248 | isa = PBXSourcesBuildPhase;
249 | buildActionMask = 2147483647;
250 | files = (
251 | 8234EC301E0C8CB5001AEDB1 /* SequenceExtension.swift in Sources */,
252 | 8234EC221E0C8BCE001AEDB1 /* SourceEditorExtension.swift in Sources */,
253 | 8234EC241E0C8BCE001AEDB1 /* SourceEditorCommand.swift in Sources */,
254 | 8234EC2F1E0C8CB5001AEDB1 /* NSArrayExtension.swift in Sources */,
255 | );
256 | runOnlyForDeploymentPostprocessing = 0;
257 | };
258 | /* End PBXSourcesBuildPhase section */
259 |
260 | /* Begin PBXTargetDependency section */
261 | 8234EC271E0C8BCE001AEDB1 /* PBXTargetDependency */ = {
262 | isa = PBXTargetDependency;
263 | target = 8234EC191E0C8BCE001AEDB1 /* DeclareTypeExtension */;
264 | targetProxy = 8234EC261E0C8BCE001AEDB1 /* PBXContainerItemProxy */;
265 | };
266 | /* End PBXTargetDependency section */
267 |
268 | /* Begin PBXVariantGroup section */
269 | 8234EC0D1E0C892B001AEDB1 /* MainMenu.xib */ = {
270 | isa = PBXVariantGroup;
271 | children = (
272 | 8234EC0E1E0C892B001AEDB1 /* Base */,
273 | );
274 | name = MainMenu.xib;
275 | sourceTree = "";
276 | };
277 | /* End PBXVariantGroup section */
278 |
279 | /* Begin XCBuildConfiguration section */
280 | 8234EC111E0C892B001AEDB1 /* Debug */ = {
281 | isa = XCBuildConfiguration;
282 | buildSettings = {
283 | ALWAYS_SEARCH_USER_PATHS = NO;
284 | CLANG_ANALYZER_NONNULL = YES;
285 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
286 | CLANG_CXX_LIBRARY = "libc++";
287 | CLANG_ENABLE_MODULES = YES;
288 | CLANG_ENABLE_OBJC_ARC = YES;
289 | CLANG_WARN_BOOL_CONVERSION = YES;
290 | CLANG_WARN_CONSTANT_CONVERSION = YES;
291 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
292 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
293 | CLANG_WARN_EMPTY_BODY = YES;
294 | CLANG_WARN_ENUM_CONVERSION = YES;
295 | CLANG_WARN_INFINITE_RECURSION = YES;
296 | CLANG_WARN_INT_CONVERSION = YES;
297 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
298 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
299 | CLANG_WARN_UNREACHABLE_CODE = YES;
300 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
301 | CODE_SIGN_IDENTITY = "-";
302 | COPY_PHASE_STRIP = NO;
303 | DEBUG_INFORMATION_FORMAT = dwarf;
304 | ENABLE_STRICT_OBJC_MSGSEND = YES;
305 | ENABLE_TESTABILITY = YES;
306 | GCC_C_LANGUAGE_STANDARD = gnu99;
307 | GCC_DYNAMIC_NO_PIC = NO;
308 | GCC_NO_COMMON_BLOCKS = YES;
309 | GCC_OPTIMIZATION_LEVEL = 0;
310 | GCC_PREPROCESSOR_DEFINITIONS = (
311 | "DEBUG=1",
312 | "$(inherited)",
313 | );
314 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
315 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
316 | GCC_WARN_UNDECLARED_SELECTOR = YES;
317 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
318 | GCC_WARN_UNUSED_FUNCTION = YES;
319 | GCC_WARN_UNUSED_VARIABLE = YES;
320 | MACOSX_DEPLOYMENT_TARGET = 10.12;
321 | MTL_ENABLE_DEBUG_INFO = YES;
322 | ONLY_ACTIVE_ARCH = YES;
323 | SDKROOT = macosx;
324 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
325 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
326 | };
327 | name = Debug;
328 | };
329 | 8234EC121E0C892B001AEDB1 /* Release */ = {
330 | isa = XCBuildConfiguration;
331 | buildSettings = {
332 | ALWAYS_SEARCH_USER_PATHS = NO;
333 | CLANG_ANALYZER_NONNULL = YES;
334 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
335 | CLANG_CXX_LIBRARY = "libc++";
336 | CLANG_ENABLE_MODULES = YES;
337 | CLANG_ENABLE_OBJC_ARC = YES;
338 | CLANG_WARN_BOOL_CONVERSION = YES;
339 | CLANG_WARN_CONSTANT_CONVERSION = YES;
340 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
341 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
342 | CLANG_WARN_EMPTY_BODY = YES;
343 | CLANG_WARN_ENUM_CONVERSION = YES;
344 | CLANG_WARN_INFINITE_RECURSION = YES;
345 | CLANG_WARN_INT_CONVERSION = YES;
346 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
347 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
348 | CLANG_WARN_UNREACHABLE_CODE = YES;
349 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
350 | CODE_SIGN_IDENTITY = "-";
351 | COPY_PHASE_STRIP = NO;
352 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
353 | ENABLE_NS_ASSERTIONS = NO;
354 | ENABLE_STRICT_OBJC_MSGSEND = YES;
355 | GCC_C_LANGUAGE_STANDARD = gnu99;
356 | GCC_NO_COMMON_BLOCKS = YES;
357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
358 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
359 | GCC_WARN_UNDECLARED_SELECTOR = YES;
360 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
361 | GCC_WARN_UNUSED_FUNCTION = YES;
362 | GCC_WARN_UNUSED_VARIABLE = YES;
363 | MACOSX_DEPLOYMENT_TARGET = 10.12;
364 | MTL_ENABLE_DEBUG_INFO = NO;
365 | SDKROOT = macosx;
366 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
367 | };
368 | name = Release;
369 | };
370 | 8234EC141E0C892B001AEDB1 /* Debug */ = {
371 | isa = XCBuildConfiguration;
372 | buildSettings = {
373 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
374 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
375 | CODE_SIGN_IDENTITY = "Mac Developer";
376 | COMBINE_HIDPI_IMAGES = YES;
377 | DEVELOPMENT_TEAM = 34BUG46ZSN;
378 | INFOPLIST_FILE = DeclareType/Info.plist;
379 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
380 | PRODUCT_BUNDLE_IDENTIFIER = com.DeclareType;
381 | PRODUCT_NAME = "$(TARGET_NAME)";
382 | SWIFT_VERSION = 3.0;
383 | };
384 | name = Debug;
385 | };
386 | 8234EC151E0C892B001AEDB1 /* Release */ = {
387 | isa = XCBuildConfiguration;
388 | buildSettings = {
389 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
390 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
391 | CODE_SIGN_IDENTITY = "Mac Developer";
392 | COMBINE_HIDPI_IMAGES = YES;
393 | DEVELOPMENT_TEAM = 34BUG46ZSN;
394 | INFOPLIST_FILE = DeclareType/Info.plist;
395 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
396 | PRODUCT_BUNDLE_IDENTIFIER = com.DeclareType;
397 | PRODUCT_NAME = "$(TARGET_NAME)";
398 | SWIFT_VERSION = 3.0;
399 | };
400 | name = Release;
401 | };
402 | 8234EC291E0C8BCE001AEDB1 /* Debug */ = {
403 | isa = XCBuildConfiguration;
404 | buildSettings = {
405 | CODE_SIGN_ENTITLEMENTS = DeclareTypeExtension/DeclareTypeExtension.entitlements;
406 | CODE_SIGN_IDENTITY = "Mac Developer";
407 | COMBINE_HIDPI_IMAGES = YES;
408 | DEVELOPMENT_TEAM = 34BUG46ZSN;
409 | INFOPLIST_FILE = DeclareTypeExtension/Info.plist;
410 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks";
411 | MACOSX_DEPLOYMENT_TARGET = 10.11;
412 | PRODUCT_BUNDLE_IDENTIFIER = com.DeclareType.DeclareTypeExtension;
413 | PRODUCT_NAME = "$(TARGET_NAME)";
414 | SKIP_INSTALL = YES;
415 | SWIFT_VERSION = 3.0;
416 | };
417 | name = Debug;
418 | };
419 | 8234EC2A1E0C8BCE001AEDB1 /* Release */ = {
420 | isa = XCBuildConfiguration;
421 | buildSettings = {
422 | CODE_SIGN_ENTITLEMENTS = DeclareTypeExtension/DeclareTypeExtension.entitlements;
423 | CODE_SIGN_IDENTITY = "Mac Developer";
424 | COMBINE_HIDPI_IMAGES = YES;
425 | DEVELOPMENT_TEAM = 34BUG46ZSN;
426 | INFOPLIST_FILE = DeclareTypeExtension/Info.plist;
427 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/../../../../Frameworks";
428 | MACOSX_DEPLOYMENT_TARGET = 10.11;
429 | PRODUCT_BUNDLE_IDENTIFIER = com.DeclareType.DeclareTypeExtension;
430 | PRODUCT_NAME = "$(TARGET_NAME)";
431 | SKIP_INSTALL = YES;
432 | SWIFT_VERSION = 3.0;
433 | };
434 | name = Release;
435 | };
436 | /* End XCBuildConfiguration section */
437 |
438 | /* Begin XCConfigurationList section */
439 | 8234EC011E0C892B001AEDB1 /* Build configuration list for PBXProject "DeclareType" */ = {
440 | isa = XCConfigurationList;
441 | buildConfigurations = (
442 | 8234EC111E0C892B001AEDB1 /* Debug */,
443 | 8234EC121E0C892B001AEDB1 /* Release */,
444 | );
445 | defaultConfigurationIsVisible = 0;
446 | defaultConfigurationName = Release;
447 | };
448 | 8234EC131E0C892B001AEDB1 /* Build configuration list for PBXNativeTarget "DeclareType" */ = {
449 | isa = XCConfigurationList;
450 | buildConfigurations = (
451 | 8234EC141E0C892B001AEDB1 /* Debug */,
452 | 8234EC151E0C892B001AEDB1 /* Release */,
453 | );
454 | defaultConfigurationIsVisible = 0;
455 | defaultConfigurationName = Release;
456 | };
457 | 8234EC2B1E0C8BCE001AEDB1 /* Build configuration list for PBXNativeTarget "DeclareTypeExtension" */ = {
458 | isa = XCConfigurationList;
459 | buildConfigurations = (
460 | 8234EC291E0C8BCE001AEDB1 /* Debug */,
461 | 8234EC2A1E0C8BCE001AEDB1 /* Release */,
462 | );
463 | defaultConfigurationIsVisible = 0;
464 | };
465 | /* End XCConfigurationList section */
466 | };
467 | rootObject = 8234EBFE1E0C892B001AEDB1 /* Project object */;
468 | }
469 |
--------------------------------------------------------------------------------
/DeclareType/Base.lproj/MainMenu.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
681 |
682 |
683 |
684 |
685 |
686 |
687 |
688 |
689 |
690 |
691 |
692 |
693 |
--------------------------------------------------------------------------------