├── Build Settings.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── Build Settings.xcscheme ├── Build Settings ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ └── Main.storyboard ├── Build Settings-Bridging-Header.h ├── Build_Settings.entitlements ├── Info.plist ├── ViewController.swift ├── WindowController.swift ├── Xcode.h ├── XcodeBridge.h └── XcodeBridge.m ├── LICENSE ├── README.md └── screenshot.png /Build Settings.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2733018923EDCAF10022D27E /* XcodeBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 2733018823EDCAF10022D27E /* XcodeBridge.m */; }; 11 | 27B1036423EDB01100B0CB36 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B1036323EDB01100B0CB36 /* AppDelegate.swift */; }; 12 | 27B1036623EDB01100B0CB36 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27B1036523EDB01100B0CB36 /* ViewController.swift */; }; 13 | 27B1036823EDB01200B0CB36 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 27B1036723EDB01200B0CB36 /* Assets.xcassets */; }; 14 | 27B1036B23EDB01200B0CB36 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 27B1036923EDB01200B0CB36 /* Main.storyboard */; }; 15 | 27C32D1D23EF57B0002F3701 /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27C32D1C23EF57B0002F3701 /* WindowController.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 2733018623EDC6560022D27E /* Xcode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Xcode.h; sourceTree = ""; }; 20 | 2733018723EDCAF10022D27E /* XcodeBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XcodeBridge.h; sourceTree = ""; }; 21 | 2733018823EDCAF10022D27E /* XcodeBridge.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XcodeBridge.m; sourceTree = ""; }; 22 | 27B1036023EDB01100B0CB36 /* Xconfig.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Xconfig.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 27B1036323EDB01100B0CB36 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | 27B1036523EDB01100B0CB36 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 25 | 27B1036723EDB01200B0CB36 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 27B1036A23EDB01200B0CB36 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 27B1036C23EDB01200B0CB36 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 27B1036D23EDB01200B0CB36 /* Build_Settings.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Build_Settings.entitlements; sourceTree = ""; }; 29 | 27B1037423EDB04300B0CB36 /* Build Settings-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Build Settings-Bridging-Header.h"; sourceTree = ""; }; 30 | 27C32D1C23EF57B0002F3701 /* WindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowController.swift; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | 27B1035D23EDB01100B0CB36 /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | 27B1035723EDB01100B0CB36 = { 45 | isa = PBXGroup; 46 | children = ( 47 | 27B1036223EDB01100B0CB36 /* Build Settings */, 48 | 27B1036123EDB01100B0CB36 /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | 27B1036123EDB01100B0CB36 /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | 27B1036023EDB01100B0CB36 /* Xconfig.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | 27B1036223EDB01100B0CB36 /* Build Settings */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | 2733018623EDC6560022D27E /* Xcode.h */, 64 | 27B1037423EDB04300B0CB36 /* Build Settings-Bridging-Header.h */, 65 | 27B1036323EDB01100B0CB36 /* AppDelegate.swift */, 66 | 27B1036523EDB01100B0CB36 /* ViewController.swift */, 67 | 27C32D1C23EF57B0002F3701 /* WindowController.swift */, 68 | 2733018723EDCAF10022D27E /* XcodeBridge.h */, 69 | 2733018823EDCAF10022D27E /* XcodeBridge.m */, 70 | 27B1036723EDB01200B0CB36 /* Assets.xcassets */, 71 | 27B1036923EDB01200B0CB36 /* Main.storyboard */, 72 | 27B1036C23EDB01200B0CB36 /* Info.plist */, 73 | 27B1036D23EDB01200B0CB36 /* Build_Settings.entitlements */, 74 | ); 75 | path = "Build Settings"; 76 | sourceTree = ""; 77 | }; 78 | /* End PBXGroup section */ 79 | 80 | /* Begin PBXNativeTarget section */ 81 | 27B1035F23EDB01100B0CB36 /* Build Settings */ = { 82 | isa = PBXNativeTarget; 83 | buildConfigurationList = 27B1037023EDB01200B0CB36 /* Build configuration list for PBXNativeTarget "Build Settings" */; 84 | buildPhases = ( 85 | 27B1035C23EDB01100B0CB36 /* Sources */, 86 | 27B1035D23EDB01100B0CB36 /* Frameworks */, 87 | 27B1035E23EDB01100B0CB36 /* Resources */, 88 | ); 89 | buildRules = ( 90 | ); 91 | dependencies = ( 92 | ); 93 | name = "Build Settings"; 94 | productName = "Build Settings"; 95 | productReference = 27B1036023EDB01100B0CB36 /* Xconfig.app */; 96 | productType = "com.apple.product-type.application"; 97 | }; 98 | /* End PBXNativeTarget section */ 99 | 100 | /* Begin PBXProject section */ 101 | 27B1035823EDB01100B0CB36 /* Project object */ = { 102 | isa = PBXProject; 103 | attributes = { 104 | LastSwiftUpdateCheck = 1120; 105 | LastUpgradeCheck = 1120; 106 | ORGANIZATIONNAME = "Paulo F. Andrade"; 107 | TargetAttributes = { 108 | 27B1035F23EDB01100B0CB36 = { 109 | CreatedOnToolsVersion = 11.2.1; 110 | LastSwiftMigration = 1120; 111 | }; 112 | }; 113 | }; 114 | buildConfigurationList = 27B1035B23EDB01100B0CB36 /* Build configuration list for PBXProject "Build Settings" */; 115 | compatibilityVersion = "Xcode 9.3"; 116 | developmentRegion = en; 117 | hasScannedForEncodings = 0; 118 | knownRegions = ( 119 | en, 120 | Base, 121 | ); 122 | mainGroup = 27B1035723EDB01100B0CB36; 123 | productRefGroup = 27B1036123EDB01100B0CB36 /* Products */; 124 | projectDirPath = ""; 125 | projectRoot = ""; 126 | targets = ( 127 | 27B1035F23EDB01100B0CB36 /* Build Settings */, 128 | ); 129 | }; 130 | /* End PBXProject section */ 131 | 132 | /* Begin PBXResourcesBuildPhase section */ 133 | 27B1035E23EDB01100B0CB36 /* Resources */ = { 134 | isa = PBXResourcesBuildPhase; 135 | buildActionMask = 2147483647; 136 | files = ( 137 | 27B1036823EDB01200B0CB36 /* Assets.xcassets in Resources */, 138 | 27B1036B23EDB01200B0CB36 /* Main.storyboard in Resources */, 139 | ); 140 | runOnlyForDeploymentPostprocessing = 0; 141 | }; 142 | /* End PBXResourcesBuildPhase section */ 143 | 144 | /* Begin PBXSourcesBuildPhase section */ 145 | 27B1035C23EDB01100B0CB36 /* Sources */ = { 146 | isa = PBXSourcesBuildPhase; 147 | buildActionMask = 2147483647; 148 | files = ( 149 | 27B1036623EDB01100B0CB36 /* ViewController.swift in Sources */, 150 | 27C32D1D23EF57B0002F3701 /* WindowController.swift in Sources */, 151 | 2733018923EDCAF10022D27E /* XcodeBridge.m in Sources */, 152 | 27B1036423EDB01100B0CB36 /* AppDelegate.swift in Sources */, 153 | ); 154 | runOnlyForDeploymentPostprocessing = 0; 155 | }; 156 | /* End PBXSourcesBuildPhase section */ 157 | 158 | /* Begin PBXVariantGroup section */ 159 | 27B1036923EDB01200B0CB36 /* Main.storyboard */ = { 160 | isa = PBXVariantGroup; 161 | children = ( 162 | 27B1036A23EDB01200B0CB36 /* Base */, 163 | ); 164 | name = Main.storyboard; 165 | sourceTree = ""; 166 | }; 167 | /* End PBXVariantGroup section */ 168 | 169 | /* Begin XCBuildConfiguration section */ 170 | 27B1036E23EDB01200B0CB36 /* Debug */ = { 171 | isa = XCBuildConfiguration; 172 | buildSettings = { 173 | ALWAYS_SEARCH_USER_PATHS = NO; 174 | CLANG_ANALYZER_NONNULL = YES; 175 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 176 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 177 | CLANG_CXX_LIBRARY = "libc++"; 178 | CLANG_ENABLE_MODULES = YES; 179 | CLANG_ENABLE_OBJC_ARC = YES; 180 | CLANG_ENABLE_OBJC_WEAK = YES; 181 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 182 | CLANG_WARN_BOOL_CONVERSION = YES; 183 | CLANG_WARN_COMMA = YES; 184 | CLANG_WARN_CONSTANT_CONVERSION = YES; 185 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 186 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 187 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 188 | CLANG_WARN_EMPTY_BODY = YES; 189 | CLANG_WARN_ENUM_CONVERSION = YES; 190 | CLANG_WARN_INFINITE_RECURSION = YES; 191 | CLANG_WARN_INT_CONVERSION = YES; 192 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 193 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 194 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 195 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 196 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 197 | CLANG_WARN_STRICT_PROTOTYPES = YES; 198 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 199 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 200 | CLANG_WARN_UNREACHABLE_CODE = YES; 201 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 202 | COPY_PHASE_STRIP = NO; 203 | DEBUG_INFORMATION_FORMAT = dwarf; 204 | ENABLE_STRICT_OBJC_MSGSEND = YES; 205 | ENABLE_TESTABILITY = YES; 206 | GCC_C_LANGUAGE_STANDARD = gnu11; 207 | GCC_DYNAMIC_NO_PIC = NO; 208 | GCC_NO_COMMON_BLOCKS = YES; 209 | GCC_OPTIMIZATION_LEVEL = 0; 210 | GCC_PREPROCESSOR_DEFINITIONS = ( 211 | "DEBUG=1", 212 | "$(inherited)", 213 | ); 214 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 215 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 216 | GCC_WARN_UNDECLARED_SELECTOR = YES; 217 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 218 | GCC_WARN_UNUSED_FUNCTION = YES; 219 | GCC_WARN_UNUSED_VARIABLE = YES; 220 | MACOSX_DEPLOYMENT_TARGET = 10.15; 221 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 222 | MTL_FAST_MATH = YES; 223 | ONLY_ACTIVE_ARCH = YES; 224 | SDKROOT = macosx; 225 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 226 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 227 | }; 228 | name = Debug; 229 | }; 230 | 27B1036F23EDB01200B0CB36 /* Release */ = { 231 | isa = XCBuildConfiguration; 232 | buildSettings = { 233 | ALWAYS_SEARCH_USER_PATHS = NO; 234 | CLANG_ANALYZER_NONNULL = YES; 235 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 236 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 237 | CLANG_CXX_LIBRARY = "libc++"; 238 | CLANG_ENABLE_MODULES = YES; 239 | CLANG_ENABLE_OBJC_ARC = YES; 240 | CLANG_ENABLE_OBJC_WEAK = YES; 241 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 242 | CLANG_WARN_BOOL_CONVERSION = YES; 243 | CLANG_WARN_COMMA = YES; 244 | CLANG_WARN_CONSTANT_CONVERSION = YES; 245 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 246 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 247 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 248 | CLANG_WARN_EMPTY_BODY = YES; 249 | CLANG_WARN_ENUM_CONVERSION = YES; 250 | CLANG_WARN_INFINITE_RECURSION = YES; 251 | CLANG_WARN_INT_CONVERSION = YES; 252 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 253 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 254 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 255 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 256 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 257 | CLANG_WARN_STRICT_PROTOTYPES = YES; 258 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 259 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | COPY_PHASE_STRIP = NO; 263 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 264 | ENABLE_NS_ASSERTIONS = NO; 265 | ENABLE_STRICT_OBJC_MSGSEND = YES; 266 | GCC_C_LANGUAGE_STANDARD = gnu11; 267 | GCC_NO_COMMON_BLOCKS = YES; 268 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 269 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 270 | GCC_WARN_UNDECLARED_SELECTOR = YES; 271 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 272 | GCC_WARN_UNUSED_FUNCTION = YES; 273 | GCC_WARN_UNUSED_VARIABLE = YES; 274 | MACOSX_DEPLOYMENT_TARGET = 10.15; 275 | MTL_ENABLE_DEBUG_INFO = NO; 276 | MTL_FAST_MATH = YES; 277 | SDKROOT = macosx; 278 | SWIFT_COMPILATION_MODE = wholemodule; 279 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 280 | }; 281 | name = Release; 282 | }; 283 | 27B1037123EDB01200B0CB36 /* Debug */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 287 | CLANG_ENABLE_MODULES = YES; 288 | CODE_SIGN_ENTITLEMENTS = "Build Settings/Build_Settings.entitlements"; 289 | CODE_SIGN_STYLE = Automatic; 290 | COMBINE_HIDPI_IMAGES = YES; 291 | CURRENT_PROJECT_VERSION = 3; 292 | DEVELOPMENT_TEAM = 32HNEEH56A; 293 | ENABLE_HARDENED_RUNTIME = YES; 294 | INFOPLIST_FILE = "Build Settings/Info.plist"; 295 | LD_RUNPATH_SEARCH_PATHS = ( 296 | "$(inherited)", 297 | "@executable_path/../Frameworks", 298 | ); 299 | MACOSX_DEPLOYMENT_TARGET = 10.14; 300 | MARKETING_VERSION = 1.2; 301 | PRODUCT_BUNDLE_IDENTIFIER = "com.outercorner.Build-Settings"; 302 | PRODUCT_NAME = Xconfig; 303 | SWIFT_OBJC_BRIDGING_HEADER = "Build Settings/Build Settings-Bridging-Header.h"; 304 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 305 | SWIFT_VERSION = 5.0; 306 | }; 307 | name = Debug; 308 | }; 309 | 27B1037223EDB01200B0CB36 /* Release */ = { 310 | isa = XCBuildConfiguration; 311 | buildSettings = { 312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 313 | CLANG_ENABLE_MODULES = YES; 314 | CODE_SIGN_ENTITLEMENTS = "Build Settings/Build_Settings.entitlements"; 315 | CODE_SIGN_STYLE = Automatic; 316 | COMBINE_HIDPI_IMAGES = YES; 317 | CURRENT_PROJECT_VERSION = 3; 318 | DEVELOPMENT_TEAM = 32HNEEH56A; 319 | ENABLE_HARDENED_RUNTIME = YES; 320 | INFOPLIST_FILE = "Build Settings/Info.plist"; 321 | LD_RUNPATH_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | "@executable_path/../Frameworks", 324 | ); 325 | MACOSX_DEPLOYMENT_TARGET = 10.14; 326 | MARKETING_VERSION = 1.2; 327 | PRODUCT_BUNDLE_IDENTIFIER = "com.outercorner.Build-Settings"; 328 | PRODUCT_NAME = Xconfig; 329 | SWIFT_OBJC_BRIDGING_HEADER = "Build Settings/Build Settings-Bridging-Header.h"; 330 | SWIFT_VERSION = 5.0; 331 | }; 332 | name = Release; 333 | }; 334 | /* End XCBuildConfiguration section */ 335 | 336 | /* Begin XCConfigurationList section */ 337 | 27B1035B23EDB01100B0CB36 /* Build configuration list for PBXProject "Build Settings" */ = { 338 | isa = XCConfigurationList; 339 | buildConfigurations = ( 340 | 27B1036E23EDB01200B0CB36 /* Debug */, 341 | 27B1036F23EDB01200B0CB36 /* Release */, 342 | ); 343 | defaultConfigurationIsVisible = 0; 344 | defaultConfigurationName = Release; 345 | }; 346 | 27B1037023EDB01200B0CB36 /* Build configuration list for PBXNativeTarget "Build Settings" */ = { 347 | isa = XCConfigurationList; 348 | buildConfigurations = ( 349 | 27B1037123EDB01200B0CB36 /* Debug */, 350 | 27B1037223EDB01200B0CB36 /* Release */, 351 | ); 352 | defaultConfigurationIsVisible = 0; 353 | defaultConfigurationName = Release; 354 | }; 355 | /* End XCConfigurationList section */ 356 | }; 357 | rootObject = 27B1035823EDB01100B0CB36 /* Project object */; 358 | } 359 | -------------------------------------------------------------------------------- /Build Settings.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Build Settings.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Build Settings.xcodeproj/xcshareddata/xcschemes/Build Settings.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Build Settings/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Build Settings 4 | // 5 | // Created by Paulo F. Andrade on 07/02/2020. 6 | // Copyright © 2020 Paulo F. Andrade. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | enum StateRestorationErrors: Error { 12 | case unknownWindowIdentifier 13 | } 14 | 15 | @NSApplicationMain 16 | class AppDelegate: NSObject, NSApplicationDelegate, NSWindowRestoration { 17 | 18 | 19 | func applicationDidFinishLaunching(_ aNotification: Notification) { 20 | // Insert code here to initialize your application 21 | 22 | if windowControllers.count == 0 { 23 | newWindow(nil) 24 | } 25 | } 26 | 27 | func applicationWillTerminate(_ aNotification: Notification) { 28 | // Insert code here to tear down your application 29 | } 30 | 31 | 32 | // MARK: Window handling 33 | static func restoreWindow(withIdentifier identifier: NSUserInterfaceItemIdentifier, state: NSCoder, completionHandler: @escaping (NSWindow?, Error?) -> Void) { 34 | if identifier.rawValue.hasPrefix("Main") { 35 | let appDelegate = NSApplication.shared.delegate as! AppDelegate 36 | completionHandler(appDelegate.newWindowController().window, nil) 37 | } 38 | else { 39 | completionHandler(nil, StateRestorationErrors.unknownWindowIdentifier) 40 | } 41 | } 42 | 43 | var windowControllers: [WindowController] = [] 44 | 45 | func newWindowController() -> WindowController { 46 | let wc = NSStoryboard(name: "Main", bundle: nil).instantiateController(withIdentifier: NSStoryboard.SceneIdentifier("MainWindowController")) as! WindowController 47 | windowControllers.append(wc) 48 | 49 | var observer: Any? = nil 50 | observer = NotificationCenter.default.addObserver(forName: NSWindow.willCloseNotification, object: wc.window, queue: .main) { [unowned wc] (note) in 51 | guard let observer = observer else { 52 | return 53 | } 54 | NotificationCenter.default.removeObserver(observer) 55 | self.windowControllers.removeAll(where: { $0 == wc }) 56 | } 57 | return wc 58 | } 59 | 60 | @IBAction func newWindow(_ sender: Any?) { 61 | let lastWindow = windowControllers.last?.window 62 | 63 | let wc = newWindowController() 64 | guard let window = wc.window else { 65 | return 66 | } 67 | window.isRestorable = true 68 | window.identifier = NSUserInterfaceItemIdentifier(rawValue: "Main \(UUID().uuidString)") 69 | window.restorationClass = Self.self 70 | wc.showWindow(sender) 71 | 72 | if let lastWindow = lastWindow { 73 | let topLeftX = lastWindow.frame.origin.x 74 | let topLeftY = lastWindow.frame.maxY 75 | let newTopLeft = lastWindow.cascadeTopLeft(from: CGPoint(x: topLeftX, y: topLeftY)) 76 | window.setFrameTopLeftPoint(newTopLeft) 77 | } 78 | } 79 | } 80 | 81 | -------------------------------------------------------------------------------- /Build Settings/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 | } -------------------------------------------------------------------------------- /Build Settings/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Build Settings/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 588 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | -------------------------------------------------------------------------------- /Build Settings/Build Settings-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "XcodeBridge.h" 6 | -------------------------------------------------------------------------------- /Build Settings/Build_Settings.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.automation.apple-events 8 | 9 | com.apple.security.files.user-selected.read-only 10 | 11 | com.apple.security.temporary-exception.apple-events 12 | 13 | com.apple.dt.Xcode 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Build Settings/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSAppleEventsUsageDescription 26 | AppleEvents are required to communicate with Xcode. 27 | NSHumanReadableCopyright 28 | Copyright © 2020 Paulo F. Andrade. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | NSSupportsAutomaticTermination 34 | 35 | NSSupportsSuddenTermination 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Build Settings/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Build Settings 4 | // 5 | // Created by Paulo F. Andrade on 07/02/2020. 6 | // Copyright © 2020 Paulo F. Andrade. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | enum Errors: Error { 12 | case xcodeNotRunning 13 | case automationAuthorizationRequired 14 | } 15 | 16 | @objcMembers 17 | class BuildSetting: NSObject { 18 | var name: String 19 | var value: String 20 | init(name: String, value: String) { 21 | self.name = name 22 | self.value = value 23 | } 24 | } 25 | 26 | 27 | class ViewController: NSViewController { 28 | 29 | var configurationPopUp: NSPopUpButton! 30 | 31 | var searchString: String? { 32 | didSet { 33 | guard let s = searchString, s.count > 0 else { 34 | settingsController.filterPredicate = nil 35 | return 36 | } 37 | settingsController.filterPredicate = NSPredicate(format: "name CONTAINS[c] %@ || value CONTAINS[c] %@", s,s) 38 | } 39 | } 40 | 41 | var windowController: WindowController? { 42 | return self.view.window?.windowController as? WindowController 43 | } 44 | 45 | override func viewWillAppear() { 46 | super.viewWillAppear() 47 | setupPopUp() 48 | } 49 | 50 | override func viewDidAppear() { 51 | super.viewDidAppear() 52 | reload(self) 53 | } 54 | 55 | @objc func reload(_ sender: Any?) { 56 | windowController?.busy = true 57 | XcodeBridge.reloadAvailableTargets { (results, error) in 58 | self.windowController?.busy = false 59 | guard let results = results else { 60 | NSAlert(error: error!).runModal() 61 | return 62 | } 63 | 64 | let targets = results.flatMap { $0.targets } 65 | self.targetSelectionController.content = targets.map { ItemWrapper(item: $0, includeProjects: results.count > 1) } 66 | 67 | if let target = targets.first { 68 | self.selectedTarget = target 69 | self.targetSelectionController.setSelectionIndex(0) 70 | 71 | } 72 | } 73 | } 74 | 75 | // MARK: Actions 76 | @objc func copy(_ sender: Any?) { 77 | let text = self.settingsController.selectedObjects 78 | .compactMap { $0 as? BuildSetting } 79 | .reduce("") { (result, setting) -> String in 80 | return "\(result)\(setting.name) = \(setting.value)\n" 81 | } 82 | NSPasteboard.general.declareTypes([.string], owner: nil) 83 | NSPasteboard.general.setString(text, forType: .string) 84 | } 85 | 86 | // MARK: Target selection 87 | 88 | @IBOutlet var targetSelectionController: NSArrayController! 89 | func setupPopUp() { 90 | let toolbarPopUp = self.view.window?.toolbar?.items 91 | .filter { $0.itemIdentifier == .init(rawValue: "ConfigurationPopUp")} 92 | .first?.view as? NSPopUpButton 93 | guard let popUp = toolbarPopUp, let controller = targetSelectionController else { 94 | return 95 | } 96 | 97 | popUp.bind(.content, to: controller, withKeyPath: "arrangedObjects", options: nil) 98 | popUp.bind(.contentValues, to: controller, withKeyPath: "arrangedObjects.path", options: nil) 99 | popUp.bind(.selectedIndex, to: controller, withKeyPath: "selectionIndex", options: nil) 100 | popUp.target = self 101 | popUp.action = #selector(popUpDidChange(_:)) 102 | } 103 | 104 | @objc func popUpDidChange(_ sender: Any?) { 105 | guard let wrapper = targetSelectionController.selectedObjects.first as? ItemWrapper else { 106 | return 107 | } 108 | selectedTarget = wrapper.item as? XCDTarget 109 | } 110 | 111 | var selectedTarget: XCDTarget? { 112 | didSet { 113 | self.configurationsController.content = selectedTarget?.configurations ?? [] 114 | self.selectedConfiguration = (self.configurationsController.selectedObjects.first as? ItemWrapper)?.item as? XCDConfiguration 115 | if let target = selectedTarget, target.configurations == nil { 116 | target.updateConfigurations { (configs) in 117 | if target == self.selectedTarget { 118 | self.configurationsController.content = configs.map { ItemWrapper(item: $0, includeProjects: false) } 119 | self.selectedConfiguration = (self.configurationsController.selectedObjects.first as? ItemWrapper)?.item as? XCDConfiguration 120 | } 121 | } 122 | } 123 | } 124 | } 125 | 126 | // MARK: Configuration selection 127 | @IBOutlet var configurationsController: NSArrayController! 128 | var selectedConfiguration: XCDConfiguration? { 129 | didSet { 130 | settingsController.content = (selectedConfiguration?.buildSettings ?? [:]).map { BuildSetting(name: $0.key, value: $0.value) } 131 | if let config = selectedConfiguration, config.buildSettings == nil { 132 | config.updateBuildSettings { (settings) in 133 | if config == self.selectedConfiguration { 134 | self.settingsController.content = settings.map { BuildSetting(name: $0.key, value: $0.value) } 135 | } 136 | } 137 | } 138 | } 139 | } 140 | 141 | @IBAction func configurationSelectionDidChange(_ sender: Any) { 142 | guard let wrapper = configurationsController.selectedObjects.first as? ItemWrapper else { 143 | return 144 | } 145 | selectedConfiguration = wrapper.item as? XCDConfiguration 146 | } 147 | 148 | // MARK: Build Settings 149 | @IBOutlet var settingsController: NSArrayController! 150 | 151 | 152 | } 153 | 154 | 155 | @objc class ItemWrapper: NSObject { 156 | var item: PopUpPathElement 157 | var includeProjects = true 158 | 159 | init(item: PopUpPathElement, includeProjects: Bool = true) { 160 | self.item = item 161 | self.includeProjects = includeProjects 162 | } 163 | 164 | @objc var path: String { 165 | var pathNames: [String] = [] 166 | pathNames.append(item.name) 167 | var current = item 168 | while let el = current.parentElement { 169 | if el.isProject { 170 | if includeProjects { 171 | pathNames.append(el.name) 172 | } 173 | } 174 | else { 175 | pathNames.append(el.name) 176 | } 177 | current = el 178 | } 179 | return pathNames.reversed().joined(separator: " > ") 180 | } 181 | 182 | override var description: String { 183 | return self.item.name 184 | } 185 | } 186 | 187 | @objc protocol PopUpPathElement: NSObjectProtocol { 188 | @objc var isProject: Bool { get } 189 | @objc var parentElement: PopUpPathElement? { get } 190 | @objc var name: String { get } 191 | } 192 | 193 | extension XCDProject: PopUpPathElement { 194 | @objc var isProject: Bool { 195 | return true 196 | } 197 | @objc var parentElement: PopUpPathElement? { 198 | return nil 199 | } 200 | } 201 | 202 | 203 | extension XCDTarget: PopUpPathElement { 204 | @objc var isProject: Bool { 205 | return false 206 | } 207 | @objc var parentElement: PopUpPathElement? { 208 | return self.project 209 | } 210 | } 211 | 212 | extension XCDConfiguration: PopUpPathElement { 213 | @objc var isProject: Bool { 214 | return false 215 | } 216 | @objc var parentElement: PopUpPathElement? { 217 | return self.target 218 | } 219 | } 220 | -------------------------------------------------------------------------------- /Build Settings/WindowController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WindowController.swift 3 | // Build Settings 4 | // 5 | // Created by Paulo F. Andrade on 08/02/2020. 6 | // Copyright © 2020 Paulo F. Andrade. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class WindowController: NSWindowController, NSTextFieldDelegate { 12 | 13 | 14 | var viewController: ViewController? { 15 | return self.window?.contentViewController as? ViewController 16 | } 17 | 18 | 19 | @IBOutlet weak var searchField: NSSearchField! 20 | func controlTextDidChange(_ obj: Notification) { 21 | viewController?.searchString = searchField.stringValue 22 | } 23 | 24 | 25 | @objc dynamic var busy: Bool = false 26 | } 27 | -------------------------------------------------------------------------------- /Build Settings/Xcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Xcode.h 3 | */ 4 | 5 | #import 6 | #import 7 | 8 | 9 | @class XcodeApplication, XcodeDocument, XcodeWindow, XcodeFileDocument, XcodeTextDocument, XcodeSourceDocument, XcodeWorkspaceDocument, XcodeSchemeActionResult, XcodeSchemeActionIssue, XcodeBuildError, XcodeBuildWarning, XcodeAnalyzerIssue, XcodeTestFailure, XcodeScheme, XcodeRunDestination, XcodeDevice, XcodeBuildConfiguration, XcodeProject, XcodeBuildSetting, XcodeResolvedBuildSetting, XcodeTarget; 10 | 11 | enum XcodeSaveOptions { 12 | XcodeSaveOptionsYes = 'yes ' /* Save the file. */, 13 | XcodeSaveOptionsNo = 'no ' /* Do not save the file. */, 14 | XcodeSaveOptionsAsk = 'ask ' /* Ask the user whether or not to save the file. */ 15 | }; 16 | typedef enum XcodeSaveOptions XcodeSaveOptions; 17 | 18 | // The status of a scheme action result object. 19 | enum XcodeSchemeActionResultStatus { 20 | XcodeSchemeActionResultStatusNotYetStarted = 'srsn' /* The action has not yet started. */, 21 | XcodeSchemeActionResultStatusRunning = 'srsr' /* The action is in progress. */, 22 | XcodeSchemeActionResultStatusCancelled = 'srsc' /* The action was cancelled. */, 23 | XcodeSchemeActionResultStatusFailed = 'srsf' /* The action ran but did not complete successfully. */, 24 | XcodeSchemeActionResultStatusErrorOccurred = 'srse' /* The action was not able to run due to an error. */, 25 | XcodeSchemeActionResultStatusSucceeded = 'srss' /* The action succeeded. */ 26 | }; 27 | typedef enum XcodeSchemeActionResultStatus XcodeSchemeActionResultStatus; 28 | 29 | @protocol XcodeGenericMethods 30 | 31 | - (void) closeSaving:(XcodeSaveOptions)saving savingIn:(NSURL *)savingIn; // Close a document. 32 | - (void) delete; // Delete an object. 33 | - (void) moveTo:(SBObject *)to; // Move an object to a new location. 34 | - (XcodeSchemeActionResult *) build; // Invoke the "build" scheme action. This command should be sent to a workspace document. The build will be performed using the workspace document's current active scheme and active run destination. This command does not wait for the action to complete; its progress can be tracked with the returned scheme action result. 35 | - (XcodeSchemeActionResult *) clean; // Invoke the "clean" scheme action. This command should be sent to a workspace document. The clean will be performed using the workspace document's current active scheme and active run destination. This command does not wait for the action to complete; its progress can be tracked with the returned scheme action result. 36 | - (void) stop; // Stop the active scheme action, if one is running. This command should be sent to a workspace document. This command does not wait for the action to stop. 37 | - (XcodeSchemeActionResult *) runWithCommandLineArguments:(id)withCommandLineArguments withEnvironmentVariables:(id)withEnvironmentVariables; // Invoke the "run" scheme action. This command should be sent to a workspace document. The run action will be performed using the workspace document's current active scheme and active run destination. This command does not wait for the action to complete; its progress can be tracked with the returned scheme action result. 38 | - (XcodeSchemeActionResult *) testWithCommandLineArguments:(id)withCommandLineArguments withEnvironmentVariables:(id)withEnvironmentVariables; // Invoke the "test" scheme action. This command should be sent to a workspace document. The test action will be performed using the workspace document's current active scheme and active run destination. This command does not wait for the action to complete; its progress can be tracked with the returned scheme action result. 39 | 40 | @end 41 | 42 | 43 | 44 | /* 45 | * Standard Suite 46 | */ 47 | 48 | // The application's top-level scripting object. 49 | @interface XcodeApplication : SBApplication 50 | 51 | - (SBElementArray *) documents; 52 | - (SBElementArray *) windows; 53 | 54 | @property (copy, readonly) NSString *name; // The name of the application. 55 | @property (readonly) BOOL frontmost; // Is this the active application? 56 | @property (copy, readonly) NSString *version; // The version number of the application. 57 | 58 | - (id) open:(id)x; // Open a document. 59 | - (void) quitSaving:(XcodeSaveOptions)saving; // Quit the application. 60 | - (BOOL) exists:(id)x; // Verify that an object exists. 61 | 62 | @end 63 | 64 | // A document. 65 | @interface XcodeDocument : SBObject 66 | 67 | @property (copy, readonly) NSString *name; // Its name. 68 | @property (readonly) BOOL modified; // Has it been modified since the last save? 69 | @property (copy, readonly) NSURL *file; // Its location on disk, if it has one. 70 | 71 | 72 | @end 73 | 74 | // A window. 75 | @interface XcodeWindow : SBObject 76 | 77 | @property (copy, readonly) NSString *name; // The title of the window. 78 | - (NSInteger) id; // The unique identifier of the window. 79 | @property NSInteger index; // The index of the window, ordered front to back. 80 | @property NSRect bounds; // The bounding rectangle of the window. 81 | @property (readonly) BOOL closeable; // Does the window have a close button? 82 | @property (readonly) BOOL miniaturizable; // Does the window have a minimize button? 83 | @property BOOL miniaturized; // Is the window minimized right now? 84 | @property (readonly) BOOL resizable; // Can the window be resized? 85 | @property BOOL visible; // Is the window visible right now? 86 | @property (readonly) BOOL zoomable; // Does the window have a zoom button? 87 | @property BOOL zoomed; // Is the window zoomed right now? 88 | @property (copy, readonly) XcodeDocument *document; // The document whose contents are displayed in the window. 89 | 90 | 91 | @end 92 | 93 | 94 | 95 | /* 96 | * Xcode Application Suite 97 | */ 98 | 99 | // The Xcode application. 100 | @interface XcodeApplication (XcodeApplicationSuite) 101 | 102 | - (SBElementArray *) fileDocuments; 103 | - (SBElementArray *) sourceDocuments; 104 | - (SBElementArray *) workspaceDocuments; 105 | 106 | @property (copy) XcodeWorkspaceDocument *activeWorkspaceDocument; // The active workspace document in Xcode. 107 | 108 | @end 109 | 110 | 111 | 112 | /* 113 | * Xcode Document Suite 114 | */ 115 | 116 | // An Xcode-compatible document. 117 | @interface XcodeDocument (XcodeDocumentSuite) 118 | 119 | @property (copy) NSString *path; // The document's path. 120 | 121 | @end 122 | 123 | // A document that represents a file on disk. It also provides access to the window it appears in. 124 | @interface XcodeFileDocument : XcodeDocument 125 | 126 | 127 | @end 128 | 129 | // A document that represents a text file on disk. It also provides access to the window it appears in. 130 | @interface XcodeTextDocument : XcodeFileDocument 131 | 132 | @property (copy) NSArray *selectedCharacterRange; // The first and last character positions in the selection. 133 | @property (copy) NSArray *selectedParagraphRange; // The first and last paragraph positions that contain the selection. 134 | @property (copy) NSString *text; // The text of the text file referenced. 135 | @property BOOL notifiesWhenClosing; // Should Xcode notify other apps when this document is closed? 136 | 137 | 138 | @end 139 | 140 | // A document that represents a source file on disk. It also provides access to the window it appears in. 141 | @interface XcodeSourceDocument : XcodeTextDocument 142 | 143 | 144 | @end 145 | 146 | // A document that represents a workspace on disk. Workspaces are the top-level container for almost all objects and commands in Xcode. 147 | @interface XcodeWorkspaceDocument : XcodeDocument 148 | 149 | - (SBElementArray *) projects; 150 | - (SBElementArray *) schemes; 151 | - (SBElementArray *) runDestinations; 152 | 153 | @property BOOL loaded; // Whether the workspace document has finsished loading after being opened. Messages sent to a workspace document before it has loaded will result in errors. 154 | @property (copy) XcodeScheme *activeScheme; // The workspace's scheme that will be used for scheme actions. 155 | @property (copy) XcodeRunDestination *activeRunDestination; // The workspace's run destination that will be used for scheme actions. 156 | @property (copy) XcodeSchemeActionResult *lastSchemeActionResult; // The scheme action result for the last scheme action command issued to the workspace document. 157 | @property (copy, readonly) NSURL *file; // The workspace document's location on disk, if it has one. 158 | 159 | 160 | @end 161 | 162 | 163 | 164 | /* 165 | * Xcode Scheme Suite 166 | */ 167 | 168 | // An object describing the result of performing a scheme action command. 169 | @interface XcodeSchemeActionResult : SBObject 170 | 171 | - (SBElementArray *) buildErrors; 172 | - (SBElementArray *) buildWarnings; 173 | - (SBElementArray *) analyzerIssues; 174 | - (SBElementArray *) testFailures; 175 | 176 | - (NSString *) id; // The unique identifier for the scheme. 177 | @property (readonly) BOOL completed; // Whether this scheme action has completed (sucessfully or otherwise) or not. 178 | @property XcodeSchemeActionResultStatus status; // Indicates the status of the scheme action. 179 | @property (copy) NSString *errorMessage; // If the result's status is "error occurred", this will be the error message; otherwise, this will be "missing value". 180 | @property (copy) NSString *buildLog; // If this scheme action performed a build, this will be the text of the build log. 181 | 182 | 183 | @end 184 | 185 | // An issue (like an error or warning) generated by a scheme action. 186 | @interface XcodeSchemeActionIssue : SBObject 187 | 188 | @property (copy) NSString *message; // The text of the issue. 189 | @property (copy) NSString *filePath; // The file path where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. 190 | @property NSInteger startingLineNumber; // The starting line number in the file where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. 191 | @property NSInteger endingLineNumber; // The ending line number in the file where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. 192 | @property NSInteger startingColumnNumber; // The starting column number in the file where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. 193 | @property NSInteger endingColumnNumber; // The ending column number in the file where the issue occurred. This may be 'missing value' if the issue is not associated with a specific source file. 194 | 195 | 196 | @end 197 | 198 | // An error generated by a build. 199 | @interface XcodeBuildError : XcodeSchemeActionIssue 200 | 201 | 202 | @end 203 | 204 | // A warning generated by a build. 205 | @interface XcodeBuildWarning : XcodeSchemeActionIssue 206 | 207 | 208 | @end 209 | 210 | // A warning generated by the static analyzer. 211 | @interface XcodeAnalyzerIssue : XcodeSchemeActionIssue 212 | 213 | 214 | @end 215 | 216 | // A failure from a test. 217 | @interface XcodeTestFailure : XcodeSchemeActionIssue 218 | 219 | 220 | @end 221 | 222 | // A set of parameters for building, testing, launching or distributing the products of a workspace. 223 | @interface XcodeScheme : SBObject 224 | 225 | @property (copy, readonly) NSString *name; // The name of the scheme. 226 | - (NSString *) id; // The unique identifier for the scheme. 227 | 228 | 229 | @end 230 | 231 | // An object which specifies parameters such as the device and architecture for which to perform a scheme action. 232 | @interface XcodeRunDestination : SBObject 233 | 234 | @property (copy, readonly) NSString *name; // The name of the run destination, as displayed in Xcode's interface. 235 | @property (copy, readonly) NSString *architecture; // The architecture for which this run destination results in execution. 236 | @property (copy, readonly) NSString *platform; // The identifier of the platform which this run destination targets, such as "macosx", "iphoneos", "iphonesimulator", etc . 237 | @property (copy, readonly) XcodeDevice *device; // The physical or virtual device which this run destination targets. 238 | @property (copy, readonly) XcodeDevice *companionDevice; // If the run destination's device has a companion (e.g. a paired watch for a phone) which it will use, this is that device. 239 | 240 | 241 | @end 242 | 243 | // A device which can be used as the target for a scheme action, as part of a run destination. 244 | @interface XcodeDevice : SBObject 245 | 246 | @property (copy, readonly) NSString *name; // The name of the device. 247 | @property (copy, readonly) NSString *deviceIdentifier; // A stable identifier for the device, as shown in Xcode's "Devices" window. 248 | @property (copy, readonly) NSString *operatingSystemVersion; // The version of the operating system installed on the device which this run destination targets. 249 | @property (copy, readonly) NSString *deviceModel; // The model of device (e.g. "iPad Air") which this run destination targets. 250 | @property (readonly) BOOL generic; // Whether this run destination is generic instead of representing a specific device. Most destinations are not generic, but a generic destination (such as "Generic iOS Device") will be available for some platforms if no physical devices are connected. 251 | 252 | 253 | @end 254 | 255 | 256 | 257 | /* 258 | * Xcode Project Suite 259 | */ 260 | 261 | // A set of build settings for a target or project. Each target in a project has the same named build configurations as the project. 262 | @interface XcodeBuildConfiguration : SBObject 263 | 264 | - (SBElementArray *) buildSettings; 265 | - (SBElementArray *) resolvedBuildSettings; 266 | 267 | - (NSString *) id; // The unique identifier for the build configuration. 268 | @property (copy, readonly) NSString *name; // The name of the build configuration. 269 | 270 | 271 | @end 272 | 273 | // An Xcode project. Projects represent project files on disk and are always open in the context of a workspace document. 274 | @interface XcodeProject : SBObject 275 | 276 | - (SBElementArray *) buildConfigurations; 277 | - (SBElementArray *) targets; 278 | 279 | @property (copy, readonly) NSString *name; // The name of the project 280 | - (NSString *) id; // The unique identifier for the project. 281 | 282 | 283 | @end 284 | 285 | // A setting that controls how products are built. 286 | @interface XcodeBuildSetting : SBObject 287 | 288 | @property (copy) NSString *name; // The unlocalized build setting name (e.g. DSTROOT). 289 | @property (copy) NSString *value; // A string value for the build setting. 290 | 291 | 292 | @end 293 | 294 | // An object that represents a resolved value for a build setting. 295 | @interface XcodeResolvedBuildSetting : SBObject 296 | 297 | @property (copy) NSString *name; // The unlocalized build setting name (e.g. DSTROOT). 298 | @property (copy) NSString *value; // A string value for the build setting. 299 | 300 | 301 | @end 302 | 303 | // A target is a blueprint for building a product. Targets inherit build settings from their project if not overridden in the target. 304 | @interface XcodeTarget : SBObject 305 | 306 | - (SBElementArray *) buildConfigurations; 307 | 308 | @property (copy) NSString *name; // The name of this target. 309 | - (NSString *) id; // The unique identifier for the target. 310 | @property (copy, readonly) XcodeProject *project; // The project that contains this target 311 | 312 | 313 | @end 314 | 315 | -------------------------------------------------------------------------------- /Build Settings/XcodeBridge.h: -------------------------------------------------------------------------------- 1 | // 2 | // XcodeBridge.h 3 | // Build Settings 4 | // 5 | // Created by Paulo F. Andrade on 07/02/2020. 6 | // Copyright © 2020 Paulo F. Andrade. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class XCDProject, XCDTarget, XCDConfiguration; 12 | 13 | NS_ASSUME_NONNULL_BEGIN 14 | extern NSString *const XcodeBridgeErrorDomain; 15 | typedef NS_ERROR_ENUM(XcodeBridgeErrorDomain, XcodeBridgeError) { 16 | notRunning = 1, 17 | notAuthorized 18 | }; 19 | 20 | @interface XcodeBridge : NSObject 21 | 22 | + (void)reloadAvailableTargets:(void(^)(NSArray * _Nullable, NSError * _Nullable))completionBlock; 23 | 24 | @end 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | @interface XCDConfiguration: NSObject 33 | 34 | @property (nonatomic, strong, readonly) NSString *name; 35 | @property (nonatomic, strong, nullable, readonly) NSDictionary *buildSettings; 36 | @property (nonatomic, weak, readonly) XCDTarget *target; 37 | - (void)updateBuildSettings:(void(^)(NSDictionary *))completionBlock; 38 | @end 39 | 40 | @interface XCDTarget: NSObject 41 | 42 | @property (nonatomic, strong, readonly) NSString *name; 43 | @property (nonatomic, strong, nullable, readonly) NSArray *configurations; 44 | @property (nonatomic, weak, readonly) XCDProject *project; 45 | 46 | - (void)updateConfigurations:(void(^)(NSArray *))completionBlock; 47 | @end 48 | 49 | @interface XCDProject: NSObject 50 | 51 | @property (nonatomic, strong, readonly) NSString *name; 52 | @property (nonatomic, strong, readonly) NSArray *targets; 53 | 54 | @end 55 | 56 | NS_ASSUME_NONNULL_END 57 | -------------------------------------------------------------------------------- /Build Settings/XcodeBridge.m: -------------------------------------------------------------------------------- 1 | // 2 | // XcodeBridge.m 3 | // Build Settings 4 | // 5 | // Created by Paulo F. Andrade on 07/02/2020. 6 | // Copyright © 2020 Paulo F. Andrade. All rights reserved. 7 | // 8 | 9 | #import "Xcode.h" 10 | #import "XcodeBridge.h" 11 | 12 | #define XCODE_BUNDLE_ID @"com.apple.dt.Xcode" 13 | 14 | NSString *const XcodeBridgeErrorDomain = @"com.outercorner.XcodeBridge.ErrorDomain"; 15 | 16 | @interface XCDConfiguration () 17 | - (instancetype)initWithXcodeBuildConfiguration:(XcodeBuildConfiguration *)configuration; 18 | @property (nonatomic, strong) XcodeBuildConfiguration *configuration; 19 | @property (nonatomic, strong, readwrite) NSString *name; 20 | @property (nonatomic, strong, readwrite) NSDictionary *buildSettings; 21 | @property (nonatomic, weak, readwrite) XCDTarget *target; 22 | @end 23 | 24 | @interface XCDTarget () 25 | - (instancetype)initWithXcodeTarget:(XcodeTarget *)target; 26 | @property (nonatomic, strong) XcodeTarget *target; 27 | @property (nonatomic, strong, readwrite) NSString *name; 28 | @property (nonatomic, strong, readwrite) NSArray *configurations; 29 | @property (nonatomic, weak, readwrite) XCDProject *project; 30 | @end 31 | 32 | @interface XCDProject () 33 | - (instancetype)initWithXcodeProject:(XcodeProject *)project; 34 | @property (nonatomic, strong) XcodeProject *project; 35 | @property (nonatomic, strong, readwrite) NSString *name; 36 | @property (nonatomic, strong, readwrite) NSArray *targets; 37 | @end 38 | 39 | 40 | @implementation XcodeBridge 41 | 42 | + (void)reloadAvailableTargets:(void(^)(NSArray * _Nullable, NSError * _Nullable))completionBlock 43 | { 44 | XcodeApplication *xcode = [SBApplication applicationWithBundleIdentifier:XCODE_BUNDLE_ID]; 45 | 46 | if (![xcode isRunning]) { 47 | return [self failWithCode:notRunning block:completionBlock]; 48 | } 49 | 50 | dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{ 51 | NSAppleEventDescriptor *targetAppEventDescriptor = [NSAppleEventDescriptor descriptorWithBundleIdentifier:XCODE_BUNDLE_ID]; 52 | OSStatus status = AEDeterminePermissionToAutomateTarget(targetAppEventDescriptor.aeDesc, kCoreEventClass, typeWildCard, YES); 53 | 54 | if(status != noErr) { 55 | return [self failWithCode:notAuthorized block:completionBlock]; 56 | } 57 | 58 | NSMutableArray *sbProjects = [NSMutableArray array]; 59 | [[xcode workspaceDocuments] enumerateObjectsUsingBlock:^(XcodeWorkspaceDocument * _Nonnull ws, NSUInteger idx, BOOL * _Nonnull stop) { 60 | [sbProjects addObjectsFromArray:[ws projects] ?: @[]]; 61 | }]; 62 | 63 | 64 | 65 | NSMutableArray *projects = [[NSMutableArray alloc] init]; 66 | 67 | [sbProjects enumerateObjectsUsingBlock:^(XcodeProject * _Nonnull sbProject, NSUInteger idx, BOOL * _Nonnull stop) { 68 | XCDProject *project = [[XCDProject alloc] initWithXcodeProject:sbProject]; 69 | project.name = sbProject.name; 70 | NSMutableArray *targets = [[NSMutableArray alloc] init]; 71 | [[sbProject targets] enumerateObjectsUsingBlock:^(XcodeTarget * _Nonnull sbTarget, NSUInteger idx, BOOL * _Nonnull stop) { 72 | XCDTarget *target = [[XCDTarget alloc] initWithXcodeTarget:sbTarget]; 73 | target.name = sbTarget.name; 74 | target.project = project; 75 | [targets addObject:target]; 76 | }]; 77 | project.targets = targets; 78 | [projects addObject:project]; 79 | }]; 80 | 81 | dispatch_async(dispatch_get_main_queue(), ^{ 82 | completionBlock(projects, nil); 83 | }); 84 | }); 85 | } 86 | 87 | 88 | + (void)failWithCode:(NSUInteger)code block:(void(^)(NSArray * _Nullable, NSError * _Nullable))block 89 | { 90 | NSError *error = [NSError errorWithDomain:XcodeBridgeErrorDomain code:code userInfo:nil]; 91 | if ([NSThread isMainThread]) { 92 | block(nil, error); 93 | } 94 | else { 95 | dispatch_async(dispatch_get_main_queue(), ^{ 96 | block(nil, error); 97 | }); 98 | } 99 | } 100 | 101 | @end 102 | 103 | 104 | @implementation XCDConfiguration 105 | 106 | - (instancetype)initWithXcodeBuildConfiguration:(XcodeBuildConfiguration *)configuration 107 | { 108 | self = [super init]; 109 | if (self) { 110 | _configuration = configuration; 111 | } 112 | return self; 113 | } 114 | 115 | - (void)updateBuildSettings:(void(^)(NSDictionary *))completionBlock 116 | { 117 | dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{ 118 | dispatch_group_t group = dispatch_group_create(); 119 | 120 | __block NSArray *settingNames = nil; 121 | __block NSArray *settingValues = nil; 122 | dispatch_group_async(group, dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{ 123 | settingNames = [[self.configuration resolvedBuildSettings] arrayByApplyingSelector:@selector(name)]; 124 | }); 125 | dispatch_group_async(group, dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{ 126 | settingValues = [[self.configuration resolvedBuildSettings] arrayByApplyingSelector:@selector(value)]; 127 | }); 128 | 129 | dispatch_group_notify(group, dispatch_get_main_queue(), ^{ 130 | NSMutableDictionary *buildSettings = [NSMutableDictionary dictionary]; 131 | for (NSUInteger i = 0; i * _Nonnull))completionBlock 153 | { 154 | dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{ 155 | 156 | NSArray *buildConfigs = [self.target buildConfigurations]; 157 | NSMutableArray *configurations = [[NSMutableArray alloc] init]; 158 | 159 | [buildConfigs enumerateObjectsUsingBlock:^(XcodeBuildConfiguration * _Nonnull sbConfig, NSUInteger idx, BOOL * _Nonnull stop) { 160 | XCDConfiguration *configuration = [[XCDConfiguration alloc] initWithXcodeBuildConfiguration:sbConfig]; 161 | configuration.name = sbConfig.name; 162 | configuration.target = self; 163 | [configurations addObject:configuration]; 164 | }]; 165 | 166 | dispatch_async(dispatch_get_main_queue(), ^{ 167 | self.configurations = configurations; 168 | completionBlock(configurations); 169 | }); 170 | }); 171 | 172 | } 173 | 174 | @end 175 | 176 | @implementation XCDProject 177 | - (instancetype)initWithXcodeProject:(XcodeProject *)project 178 | { 179 | self = [super init]; 180 | if (self) { 181 | _project = project; 182 | } 183 | return self; 184 | } 185 | @end 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Paulo F. Andrade 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 | # Xconfig 2 | 3 | If you're like me, when working with .xcconfig files or building your shell script to include in a "Run Script" phase, you'll keep running to the Terminal to run this: 4 | 5 | ```xcodebuild -project .xcodeproj -target -showBuildSettings``` 6 | 7 | But this means, opening the terminal, cd'ing to your project's folder, remembering and typing all of that, and then piping that to a grep to figure out which build setting you want. 8 | 9 | Xconfig is simple Mac app to display build settings for the currently open Xcode projects. 10 | 11 | ![Screenshot](screenshot.png) 12 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pfandrade/Xconfig/b12618abcd3b0bac48728a13ce9a061120209674/screenshot.png --------------------------------------------------------------------------------