├── .gitignore ├── Cartfile ├── Cartfile.resolved ├── LICENSE ├── README.md ├── SimulatorController.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── SimulatorController ├── AppDelegate.swift ├── Base.lproj │ └── Main.storyboard ├── DragDropView.swift ├── FlippedClipView.swift ├── InstallAction.swift ├── Resources │ └── Assets.xcassets │ │ └── AppIcon.appiconset │ │ └── Contents.json ├── SimulatorController.swift ├── Supporting Files │ ├── Info.plist │ └── SimulatorController.sdef ├── ViewController.swift └── WindowController.swift └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | .idea/workspace.xml 20 | 21 | ## Other 22 | *.xccheckout 23 | *.moved-aside 24 | *.xcuserstate 25 | *.xcscmblueprint 26 | 27 | ## Obj-C/Swift specific 28 | *.hmap 29 | *.ipa 30 | 31 | # CocoaPods 32 | # 33 | # We recommend against adding the Pods directory to your .gitignore. However 34 | # you should judge for yourself, the pros and cons are mentioned at: 35 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 36 | # 37 | # Pods/ 38 | 39 | # Carthage 40 | # 41 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 42 | Carthage/Checkouts 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | 55 | .idea/ 56 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "facebook/FBSimulatorControl" "master" 2 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "facebook/FBSimulatorControl" "3d12e3870647105873987645843378d523865041" 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, David Lawson 2 | 3 | Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. 4 | 5 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Simulator Controller 2 | 3 | A Mac OS X application that boots, installs and launches a .app on multiple iOS simulators. 4 | 5 | Uses [FBSimulatorControl](https://github.com/facebook/FBSimulatorControl) to interface with the simulators. 6 | 7 | ![Screenshot](screenshot.png) 8 | 9 | ## Installation 10 | 11 | [Download the latest version here](https://github.com/davidlawson/SimulatorController/releases/latest). 12 | 13 | ## Usage 14 | 15 | Drag your iOS application's .app from the Products folder in your Xcode project to Simulator Controller. 16 | 17 | Select the simulators you want to launch, then press Boot or Boot & Install. 18 | 19 | When you have made changes to your app, rebuild it then press Install to reinstall it on the simulators. 20 | 21 | ## Scripting Support 22 | 23 | Add the following as a Run Script in your app's Build Phases: 24 | 25 | osascript -e "if application \"SimulatorController\" is running then tell application \"SimulatorController\" to install" 26 | 27 | Whenever you build your app and the Simulator Controller has simulators booted, this will automatically install and launch the updated app. 28 | 29 | ## Tips 30 | 31 | Some simulators do not support the x86_64 architecture. Disable "Build Active Architecture Only" in your Build Settings if you want to launch your app on both older and newer simulators. 32 | 33 | ## Building 34 | 35 | Run `carthage bootstrap` to download and build the FBSimulatorControl framework. 36 | -------------------------------------------------------------------------------- /SimulatorController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 6348BAD91C8BD96300494A00 /* FBSimulatorControl.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 6348BAD61C8BD96100494A00 /* FBSimulatorControl.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 11 | 6348BADA1C8BD96700494A00 /* FBSimulatorControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6348BAD61C8BD96100494A00 /* FBSimulatorControl.framework */; }; 12 | 6348BADC1C8BE0A300494A00 /* SimulatorController.sdef in Resources */ = {isa = PBXBuildFile; fileRef = 6348BADB1C8BE0A300494A00 /* SimulatorController.sdef */; }; 13 | 638CF59F1C8BE61800DDC8CC /* InstallAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 638CF59E1C8BE61800DDC8CC /* InstallAction.swift */; }; 14 | 63B7EB121C8ADFE600BB675C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B7EB111C8ADFE600BB675C /* AppDelegate.swift */; }; 15 | 63B7EB141C8ADFE600BB675C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B7EB131C8ADFE600BB675C /* ViewController.swift */; }; 16 | 63B7EB161C8ADFE600BB675C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63B7EB151C8ADFE600BB675C /* Assets.xcassets */; }; 17 | 63B7EB191C8ADFE600BB675C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63B7EB171C8ADFE600BB675C /* Main.storyboard */; }; 18 | 63B7EB271C8AE13300BB675C /* WindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B7EB261C8AE13300BB675C /* WindowController.swift */; }; 19 | 63B7EB2B1C8AF1F000BB675C /* FlippedClipView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B7EB2A1C8AF1F000BB675C /* FlippedClipView.swift */; }; 20 | 63B7EB2D1C8AF70B00BB675C /* DragDropView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B7EB2C1C8AF70B00BB675C /* DragDropView.swift */; }; 21 | 63B7EB2F1C8B010000BB675C /* SimulatorController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63B7EB2E1C8B010000BB675C /* SimulatorController.swift */; }; 22 | D20079631DF0A83500F47A46 /* FBControlCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D20079601DF0A83500F47A46 /* FBControlCore.framework */; }; 23 | D20079641DF0A83500F47A46 /* FBDeviceControl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D20079611DF0A83500F47A46 /* FBDeviceControl.framework */; }; 24 | D20079651DF0A83500F47A46 /* XCTestBootstrap.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D20079621DF0A83500F47A46 /* XCTestBootstrap.framework */; }; 25 | D20079661DF0A84100F47A46 /* FBControlCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D20079601DF0A83500F47A46 /* FBControlCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 26 | D20079671DF0A84100F47A46 /* FBDeviceControl.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D20079611DF0A83500F47A46 /* FBDeviceControl.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 27 | D20079681DF0A84100F47A46 /* XCTestBootstrap.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D20079621DF0A83500F47A46 /* XCTestBootstrap.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXCopyFilesBuildPhase section */ 31 | 63B7EB251C8AE05200BB675C /* Embed Frameworks */ = { 32 | isa = PBXCopyFilesBuildPhase; 33 | buildActionMask = 2147483647; 34 | dstPath = ""; 35 | dstSubfolderSpec = 10; 36 | files = ( 37 | 6348BAD91C8BD96300494A00 /* FBSimulatorControl.framework in Embed Frameworks */, 38 | D20079661DF0A84100F47A46 /* FBControlCore.framework in Embed Frameworks */, 39 | D20079671DF0A84100F47A46 /* FBDeviceControl.framework in Embed Frameworks */, 40 | D20079681DF0A84100F47A46 /* XCTestBootstrap.framework in Embed Frameworks */, 41 | ); 42 | name = "Embed Frameworks"; 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXCopyFilesBuildPhase section */ 46 | 47 | /* Begin PBXFileReference section */ 48 | 6348BAD61C8BD96100494A00 /* FBSimulatorControl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBSimulatorControl.framework; path = Carthage/Build/Mac/FBSimulatorControl.framework; sourceTree = SOURCE_ROOT; }; 49 | 6348BADB1C8BE0A300494A00 /* SimulatorController.sdef */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SimulatorController.sdef; sourceTree = ""; }; 50 | 638CF59E1C8BE61800DDC8CC /* InstallAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InstallAction.swift; sourceTree = ""; }; 51 | 63B7EB0E1C8ADFE600BB675C /* SimulatorController.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SimulatorController.app; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 63B7EB111C8ADFE600BB675C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 53 | 63B7EB131C8ADFE600BB675C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 54 | 63B7EB151C8ADFE600BB675C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 55 | 63B7EB181C8ADFE600BB675C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | 63B7EB1A1C8ADFE600BB675C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 63B7EB261C8AE13300BB675C /* WindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WindowController.swift; sourceTree = ""; }; 58 | 63B7EB2A1C8AF1F000BB675C /* FlippedClipView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlippedClipView.swift; sourceTree = ""; }; 59 | 63B7EB2C1C8AF70B00BB675C /* DragDropView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DragDropView.swift; sourceTree = ""; }; 60 | 63B7EB2E1C8B010000BB675C /* SimulatorController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SimulatorController.swift; sourceTree = ""; }; 61 | D20079601DF0A83500F47A46 /* FBControlCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBControlCore.framework; path = Carthage/Build/Mac/FBControlCore.framework; sourceTree = SOURCE_ROOT; }; 62 | D20079611DF0A83500F47A46 /* FBDeviceControl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBDeviceControl.framework; path = Carthage/Build/Mac/FBDeviceControl.framework; sourceTree = SOURCE_ROOT; }; 63 | D20079621DF0A83500F47A46 /* XCTestBootstrap.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTestBootstrap.framework; path = Carthage/Build/Mac/XCTestBootstrap.framework; sourceTree = SOURCE_ROOT; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | 63B7EB0B1C8ADFE600BB675C /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | 6348BADA1C8BD96700494A00 /* FBSimulatorControl.framework in Frameworks */, 72 | D20079631DF0A83500F47A46 /* FBControlCore.framework in Frameworks */, 73 | D20079651DF0A83500F47A46 /* XCTestBootstrap.framework in Frameworks */, 74 | D20079641DF0A83500F47A46 /* FBDeviceControl.framework in Frameworks */, 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | 63B7EB051C8ADFE600BB675C = { 82 | isa = PBXGroup; 83 | children = ( 84 | 63B7EB201C8AE04D00BB675C /* Frameworks */, 85 | 63B7EB0F1C8ADFE600BB675C /* Products */, 86 | 63B7EB101C8ADFE600BB675C /* SimulatorController */, 87 | ); 88 | sourceTree = ""; 89 | }; 90 | 63B7EB0F1C8ADFE600BB675C /* Products */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | 63B7EB0E1C8ADFE600BB675C /* SimulatorController.app */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | 63B7EB101C8ADFE600BB675C /* SimulatorController */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 63B7EB281C8AE31800BB675C /* Resources */, 102 | 63B7EB291C8AE31C00BB675C /* Supporting Files */, 103 | 63B7EB111C8ADFE600BB675C /* AppDelegate.swift */, 104 | 63B7EB171C8ADFE600BB675C /* Main.storyboard */, 105 | 63B7EB2E1C8B010000BB675C /* SimulatorController.swift */, 106 | 63B7EB2A1C8AF1F000BB675C /* FlippedClipView.swift */, 107 | 63B7EB2C1C8AF70B00BB675C /* DragDropView.swift */, 108 | 63B7EB131C8ADFE600BB675C /* ViewController.swift */, 109 | 63B7EB261C8AE13300BB675C /* WindowController.swift */, 110 | 638CF59E1C8BE61800DDC8CC /* InstallAction.swift */, 111 | ); 112 | path = SimulatorController; 113 | sourceTree = ""; 114 | }; 115 | 63B7EB201C8AE04D00BB675C /* Frameworks */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | D20079601DF0A83500F47A46 /* FBControlCore.framework */, 119 | D20079611DF0A83500F47A46 /* FBDeviceControl.framework */, 120 | D20079621DF0A83500F47A46 /* XCTestBootstrap.framework */, 121 | 6348BAD61C8BD96100494A00 /* FBSimulatorControl.framework */, 122 | ); 123 | path = Frameworks; 124 | sourceTree = ""; 125 | }; 126 | 63B7EB281C8AE31800BB675C /* Resources */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 63B7EB151C8ADFE600BB675C /* Assets.xcassets */, 130 | ); 131 | path = Resources; 132 | sourceTree = ""; 133 | }; 134 | 63B7EB291C8AE31C00BB675C /* Supporting Files */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 63B7EB1A1C8ADFE600BB675C /* Info.plist */, 138 | 6348BADB1C8BE0A300494A00 /* SimulatorController.sdef */, 139 | ); 140 | path = "Supporting Files"; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXNativeTarget section */ 146 | 63B7EB0D1C8ADFE600BB675C /* SimulatorController */ = { 147 | isa = PBXNativeTarget; 148 | buildConfigurationList = 63B7EB1D1C8ADFE600BB675C /* Build configuration list for PBXNativeTarget "SimulatorController" */; 149 | buildPhases = ( 150 | 63B7EB0A1C8ADFE600BB675C /* Sources */, 151 | 63B7EB0B1C8ADFE600BB675C /* Frameworks */, 152 | 63B7EB0C1C8ADFE600BB675C /* Resources */, 153 | 63B7EB251C8AE05200BB675C /* Embed Frameworks */, 154 | ); 155 | buildRules = ( 156 | ); 157 | dependencies = ( 158 | ); 159 | name = SimulatorController; 160 | productName = SimulatorController; 161 | productReference = 63B7EB0E1C8ADFE600BB675C /* SimulatorController.app */; 162 | productType = "com.apple.product-type.application"; 163 | }; 164 | /* End PBXNativeTarget section */ 165 | 166 | /* Begin PBXProject section */ 167 | 63B7EB061C8ADFE600BB675C /* Project object */ = { 168 | isa = PBXProject; 169 | attributes = { 170 | LastSwiftUpdateCheck = 0730; 171 | LastUpgradeCheck = 0730; 172 | ORGANIZATIONNAME = "SmartSwitch Pty Ltd"; 173 | TargetAttributes = { 174 | 63B7EB0D1C8ADFE600BB675C = { 175 | CreatedOnToolsVersion = 7.3; 176 | LastSwiftMigration = 0810; 177 | }; 178 | }; 179 | }; 180 | buildConfigurationList = 63B7EB091C8ADFE600BB675C /* Build configuration list for PBXProject "SimulatorController" */; 181 | compatibilityVersion = "Xcode 3.2"; 182 | developmentRegion = English; 183 | hasScannedForEncodings = 0; 184 | knownRegions = ( 185 | en, 186 | Base, 187 | ); 188 | mainGroup = 63B7EB051C8ADFE600BB675C; 189 | productRefGroup = 63B7EB0F1C8ADFE600BB675C /* Products */; 190 | projectDirPath = ""; 191 | projectRoot = ""; 192 | targets = ( 193 | 63B7EB0D1C8ADFE600BB675C /* SimulatorController */, 194 | ); 195 | }; 196 | /* End PBXProject section */ 197 | 198 | /* Begin PBXResourcesBuildPhase section */ 199 | 63B7EB0C1C8ADFE600BB675C /* Resources */ = { 200 | isa = PBXResourcesBuildPhase; 201 | buildActionMask = 2147483647; 202 | files = ( 203 | 6348BADC1C8BE0A300494A00 /* SimulatorController.sdef in Resources */, 204 | 63B7EB161C8ADFE600BB675C /* Assets.xcassets in Resources */, 205 | 63B7EB191C8ADFE600BB675C /* Main.storyboard in Resources */, 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | }; 209 | /* End PBXResourcesBuildPhase section */ 210 | 211 | /* Begin PBXSourcesBuildPhase section */ 212 | 63B7EB0A1C8ADFE600BB675C /* Sources */ = { 213 | isa = PBXSourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | 63B7EB2D1C8AF70B00BB675C /* DragDropView.swift in Sources */, 217 | 63B7EB141C8ADFE600BB675C /* ViewController.swift in Sources */, 218 | 63B7EB2F1C8B010000BB675C /* SimulatorController.swift in Sources */, 219 | 63B7EB271C8AE13300BB675C /* WindowController.swift in Sources */, 220 | 63B7EB121C8ADFE600BB675C /* AppDelegate.swift in Sources */, 221 | 638CF59F1C8BE61800DDC8CC /* InstallAction.swift in Sources */, 222 | 63B7EB2B1C8AF1F000BB675C /* FlippedClipView.swift in Sources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXSourcesBuildPhase section */ 227 | 228 | /* Begin PBXVariantGroup section */ 229 | 63B7EB171C8ADFE600BB675C /* Main.storyboard */ = { 230 | isa = PBXVariantGroup; 231 | children = ( 232 | 63B7EB181C8ADFE600BB675C /* Base */, 233 | ); 234 | name = Main.storyboard; 235 | path = .; 236 | sourceTree = ""; 237 | }; 238 | /* End PBXVariantGroup section */ 239 | 240 | /* Begin XCBuildConfiguration section */ 241 | 63B7EB1B1C8ADFE600BB675C /* Debug */ = { 242 | isa = XCBuildConfiguration; 243 | buildSettings = { 244 | ALWAYS_SEARCH_USER_PATHS = NO; 245 | CLANG_ANALYZER_NONNULL = YES; 246 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 247 | CLANG_CXX_LIBRARY = "libc++"; 248 | CLANG_ENABLE_MODULES = YES; 249 | CLANG_ENABLE_OBJC_ARC = YES; 250 | CLANG_WARN_BOOL_CONVERSION = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 253 | CLANG_WARN_EMPTY_BODY = YES; 254 | CLANG_WARN_ENUM_CONVERSION = YES; 255 | CLANG_WARN_INT_CONVERSION = YES; 256 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 257 | CLANG_WARN_UNREACHABLE_CODE = YES; 258 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 259 | CODE_SIGN_IDENTITY = ""; 260 | COPY_PHASE_STRIP = NO; 261 | DEBUG_INFORMATION_FORMAT = dwarf; 262 | ENABLE_STRICT_OBJC_MSGSEND = YES; 263 | ENABLE_TESTABILITY = YES; 264 | GCC_C_LANGUAGE_STANDARD = gnu99; 265 | GCC_DYNAMIC_NO_PIC = NO; 266 | GCC_NO_COMMON_BLOCKS = YES; 267 | GCC_OPTIMIZATION_LEVEL = 0; 268 | GCC_PREPROCESSOR_DEFINITIONS = ( 269 | "DEBUG=1", 270 | "$(inherited)", 271 | ); 272 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 273 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 274 | GCC_WARN_UNDECLARED_SELECTOR = YES; 275 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 276 | GCC_WARN_UNUSED_FUNCTION = YES; 277 | GCC_WARN_UNUSED_VARIABLE = YES; 278 | MACOSX_DEPLOYMENT_TARGET = 10.11; 279 | MTL_ENABLE_DEBUG_INFO = YES; 280 | ONLY_ACTIVE_ARCH = YES; 281 | SDKROOT = macosx; 282 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 283 | }; 284 | name = Debug; 285 | }; 286 | 63B7EB1C1C8ADFE600BB675C /* Release */ = { 287 | isa = XCBuildConfiguration; 288 | buildSettings = { 289 | ALWAYS_SEARCH_USER_PATHS = NO; 290 | CLANG_ANALYZER_NONNULL = YES; 291 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 292 | CLANG_CXX_LIBRARY = "libc++"; 293 | CLANG_ENABLE_MODULES = YES; 294 | CLANG_ENABLE_OBJC_ARC = YES; 295 | CLANG_WARN_BOOL_CONVERSION = YES; 296 | CLANG_WARN_CONSTANT_CONVERSION = YES; 297 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 298 | CLANG_WARN_EMPTY_BODY = YES; 299 | CLANG_WARN_ENUM_CONVERSION = YES; 300 | CLANG_WARN_INT_CONVERSION = YES; 301 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 302 | CLANG_WARN_UNREACHABLE_CODE = YES; 303 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 304 | CODE_SIGN_IDENTITY = ""; 305 | COPY_PHASE_STRIP = NO; 306 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 307 | ENABLE_NS_ASSERTIONS = NO; 308 | ENABLE_STRICT_OBJC_MSGSEND = YES; 309 | GCC_C_LANGUAGE_STANDARD = gnu99; 310 | GCC_NO_COMMON_BLOCKS = YES; 311 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 312 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 313 | GCC_WARN_UNDECLARED_SELECTOR = YES; 314 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 315 | GCC_WARN_UNUSED_FUNCTION = YES; 316 | GCC_WARN_UNUSED_VARIABLE = YES; 317 | MACOSX_DEPLOYMENT_TARGET = 10.11; 318 | MTL_ENABLE_DEBUG_INFO = NO; 319 | SDKROOT = macosx; 320 | }; 321 | name = Release; 322 | }; 323 | 63B7EB1E1C8ADFE600BB675C /* Debug */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 327 | COMBINE_HIDPI_IMAGES = YES; 328 | FRAMEWORK_SEARCH_PATHS = ( 329 | "$(inherited)", 330 | "$(PROJECT_DIR)/Carthage/Build/Mac", 331 | ); 332 | INFOPLIST_FILE = "SimulatorController/Supporting Files/Info.plist"; 333 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 334 | PRODUCT_BUNDLE_IDENTIFIER = au.com.davidlawson.SimulatorController; 335 | PRODUCT_NAME = "$(TARGET_NAME)"; 336 | SWIFT_VERSION = 3.0.1; 337 | }; 338 | name = Debug; 339 | }; 340 | 63B7EB1F1C8ADFE600BB675C /* Release */ = { 341 | isa = XCBuildConfiguration; 342 | buildSettings = { 343 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 344 | COMBINE_HIDPI_IMAGES = YES; 345 | FRAMEWORK_SEARCH_PATHS = ( 346 | "$(inherited)", 347 | "$(PROJECT_DIR)/Carthage/Build/Mac", 348 | ); 349 | INFOPLIST_FILE = "SimulatorController/Supporting Files/Info.plist"; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 351 | PRODUCT_BUNDLE_IDENTIFIER = au.com.davidlawson.SimulatorController; 352 | PRODUCT_NAME = "$(TARGET_NAME)"; 353 | SWIFT_VERSION = 3.0.1; 354 | }; 355 | name = Release; 356 | }; 357 | /* End XCBuildConfiguration section */ 358 | 359 | /* Begin XCConfigurationList section */ 360 | 63B7EB091C8ADFE600BB675C /* Build configuration list for PBXProject "SimulatorController" */ = { 361 | isa = XCConfigurationList; 362 | buildConfigurations = ( 363 | 63B7EB1B1C8ADFE600BB675C /* Debug */, 364 | 63B7EB1C1C8ADFE600BB675C /* Release */, 365 | ); 366 | defaultConfigurationIsVisible = 0; 367 | defaultConfigurationName = Release; 368 | }; 369 | 63B7EB1D1C8ADFE600BB675C /* Build configuration list for PBXNativeTarget "SimulatorController" */ = { 370 | isa = XCConfigurationList; 371 | buildConfigurations = ( 372 | 63B7EB1E1C8ADFE600BB675C /* Debug */, 373 | 63B7EB1F1C8ADFE600BB675C /* Release */, 374 | ); 375 | defaultConfigurationIsVisible = 0; 376 | defaultConfigurationName = Release; 377 | }; 378 | /* End XCConfigurationList section */ 379 | }; 380 | rootObject = 63B7EB061C8ADFE600BB675C /* Project object */; 381 | } 382 | -------------------------------------------------------------------------------- /SimulatorController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SimulatorController/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SimulatorController 4 | // 5 | // Created by David Lawson on 5/03/2016. 6 | // 7 | 8 | import Cocoa 9 | 10 | @NSApplicationMain 11 | class AppDelegate: NSObject, NSApplicationDelegate 12 | { 13 | func applicationDidFinishLaunching(aNotification: NSNotification) 14 | { 15 | // Insert code here to initialize your application 16 | } 17 | 18 | func applicationWillTerminate(aNotification: NSNotification) 19 | { 20 | // Insert code here to tear down your application 21 | } 22 | 23 | func applicationShouldTerminateAfterLastWindowClosed(sender: NSApplication) -> Bool 24 | { 25 | return true 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /SimulatorController/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 | 176 | 180 | 181 | 191 | 201 | 211 | 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 | -------------------------------------------------------------------------------- /SimulatorController/DragDropView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DragDropView.swift 3 | // SimulatorController 4 | // 5 | // Created by David Lawson on 5/03/2016. 6 | // 7 | 8 | import Cocoa 9 | 10 | @objc protocol DragDropViewDelegate: class 11 | { 12 | func dragDropViewGotURL(appURL: NSURL) 13 | } 14 | 15 | class DragDropView: NSView 16 | { 17 | @IBOutlet weak var nameView: NSTextField! 18 | @IBOutlet weak var delegate: DragDropViewDelegate! 19 | 20 | override func awakeFromNib() 21 | { 22 | super.awakeFromNib() 23 | 24 | self.register(forDraggedTypes: [ 25 | NSURLPboardType 26 | ]) 27 | 28 | let layer = CALayer() 29 | layer.backgroundColor = NSColor(white: 0.9, alpha: 1).cgColor 30 | self.wantsLayer = true 31 | self.layer = layer 32 | } 33 | 34 | override func draggingEntered(_ sender: NSDraggingInfo) -> NSDragOperation 35 | { 36 | let pboard = sender.draggingPasteboard() 37 | 38 | if pboard.types!.contains(NSURLPboardType) 39 | { 40 | let file = NSURL(from: pboard)! 41 | return file.path!.hasSuffix(".app") ? .link : [] 42 | } 43 | 44 | return [] 45 | } 46 | 47 | override func performDragOperation(_ sender: NSDraggingInfo) -> Bool 48 | { 49 | let pboard = sender.draggingPasteboard() 50 | let file = NSURL(from: pboard)! 51 | self.nameView.stringValue = file.pathComponents!.last! 52 | 53 | self.delegate.dragDropViewGotURL(appURL: file) 54 | 55 | return true 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /SimulatorController/FlippedClipView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FlippedClipView.swift 3 | // SimulatorController 4 | // 5 | // Created by David Lawson on 5/03/2016. 6 | // 7 | 8 | import Foundation 9 | import Cocoa 10 | 11 | class FlippedClipView: NSClipView 12 | { 13 | override var isFlipped: Bool { get { return true } } 14 | } 15 | -------------------------------------------------------------------------------- /SimulatorController/InstallAction.swift: -------------------------------------------------------------------------------- 1 | // 2 | // InstallAction.swift 3 | // SimulatorController 4 | // 5 | // Created by David Lawson on 6/03/2016. 6 | // 7 | 8 | import Cocoa 9 | 10 | let InstallActionNotification = NSNotification.Name("InstallActionNotification") 11 | 12 | class InstallAction: NSScriptCommand 13 | { 14 | override func performDefaultImplementation() -> Any? 15 | { 16 | NotificationCenter.default.post(name: InstallActionNotification, object: nil) 17 | return nil 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SimulatorController/Resources/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 | } -------------------------------------------------------------------------------- /SimulatorController/SimulatorController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SimulatorController.swift 3 | // SimulatorController 4 | // 5 | // Created by David Lawson on 5/03/2016. 6 | // 7 | 8 | import Foundation 9 | import FBSimulatorControl 10 | import AppKit 11 | 12 | enum Simulator: String 13 | { 14 | case iPhone4s = "iPhone 4s" 15 | case iPhone5 = "iPhone 5" 16 | case iPhone5s = "iPhone 5s" 17 | case iPhone6 = "iPhone 6" 18 | case iPhone6Plus = "iPhone 6 Plus" 19 | case iPhone6s = "iPhone 6s" 20 | case iPhone6sPlus = "iPhone 6s Plus" 21 | case iPhoneSE = "iPhone SE" 22 | case iPhone7 = "iPhone 7" 23 | case iPhone7Plus = "iPhone 7 Plus" 24 | case iPad2 = "iPad 2" 25 | case iPadAir = "iPad Air" 26 | case iPadAir2 = "iPad Air 2" 27 | case iPadPro = "iPad Pro" 28 | case iPadRetina = "iPad Retina" 29 | } 30 | 31 | enum SimulatorState 32 | { 33 | case Ready 34 | case Booted 35 | } 36 | 37 | class SimulatorController 38 | { 39 | static let availableSimulators: [Simulator] = [ 40 | .iPhone4s, 41 | .iPhone5, 42 | .iPhone5s, 43 | .iPhone6, 44 | .iPhone6Plus, 45 | .iPhone6s, 46 | .iPhone6sPlus, 47 | .iPhoneSE, 48 | .iPhone7, 49 | .iPhone7Plus, 50 | .iPad2, 51 | .iPadAir, 52 | .iPadAir2, 53 | .iPadPro, 54 | .iPadRetina 55 | ] 56 | 57 | private static let simulatorMap: [Simulator: FBSimulatorConfiguration] = [ 58 | .iPhone4s: FBSimulatorConfiguration.iPhone4s().iOS_9_3(), 59 | .iPhone5: FBSimulatorConfiguration.iPhone5(), 60 | .iPhone5s: FBSimulatorConfiguration.iPhone5s(), 61 | .iPhone6: FBSimulatorConfiguration.iPhone6(), 62 | .iPhone6Plus: FBSimulatorConfiguration.iPhone6Plus(), 63 | .iPhone6s: FBSimulatorConfiguration.iPhone6s(), 64 | .iPhone6sPlus: FBSimulatorConfiguration.iPhone6sPlus(), 65 | .iPhoneSE: FBSimulatorConfiguration.iPhoneSE(), 66 | .iPhone7: FBSimulatorConfiguration.iPhone7(), 67 | .iPhone7Plus: FBSimulatorConfiguration.iPhone7Plus(), 68 | .iPad2: FBSimulatorConfiguration.iPad2(), 69 | .iPadAir: FBSimulatorConfiguration.iPadAir(), 70 | .iPadAir2: FBSimulatorConfiguration.iPadAir2(), 71 | .iPadPro: FBSimulatorConfiguration.iPadPro(), 72 | .iPadRetina: FBSimulatorConfiguration.iPadRetina() 73 | ] 74 | 75 | private let control: FBSimulatorControl 76 | private let allocationOptions: FBSimulatorAllocationOptions 77 | private let simulatorLaunchConfiguration: FBSimulatorBootConfiguration 78 | 79 | private var application: FBApplicationDescriptor? 80 | private var launchConfiguration: FBApplicationLaunchConfiguration? 81 | 82 | private var simulators: [FBSimulator] = [] 83 | 84 | private(set) var state: SimulatorState = .Ready 85 | 86 | init() 87 | { 88 | let managementOptions: FBSimulatorManagementOptions = [.killAllOnFirstStart] 89 | let controlConfiguration = FBSimulatorControlConfiguration(deviceSetPath: nil, options: managementOptions) 90 | self.control = try! FBSimulatorControl.withConfiguration(controlConfiguration) 91 | self.allocationOptions = [.reuse] 92 | self.simulatorLaunchConfiguration = FBSimulatorBootConfiguration.scale50Percent() 93 | } 94 | 95 | func setApplication(appURL: NSURL, bundleID: String, executable: String) throws 96 | { 97 | self.application = try FBApplicationDescriptor( 98 | name: bundleID, 99 | path: appURL.path!, 100 | bundleID: bundleID, 101 | binary: FBBinaryDescriptor.binary(withPath: (appURL.appendingPathComponent(executable))!.path) 102 | ) 103 | 104 | self.launchConfiguration = FBApplicationLaunchConfiguration( 105 | application: application!, 106 | arguments: [], 107 | environment: [:], 108 | options: [] 109 | ) 110 | } 111 | 112 | func boot(simulators: Set) 113 | { 114 | let simulatorConfigurations = simulators.map { simulator in SimulatorController.simulatorMap[simulator]! } 115 | for simulatorConfiguration in simulatorConfigurations 116 | { 117 | do 118 | { 119 | let simulator = try self.control.pool.allocateSimulator(with: simulatorConfiguration, options: allocationOptions) 120 | let interact = simulator.interact 121 | if simulator.state != .booted 122 | { 123 | interact.bootSimulator(self.simulatorLaunchConfiguration) 124 | 125 | do 126 | { 127 | try interact.perform() 128 | } 129 | catch let error as NSError 130 | { 131 | NSAlert(error: error).runModal() 132 | } 133 | 134 | self.simulators.append(simulator) 135 | } 136 | } 137 | catch let error as NSError 138 | { 139 | NSAlert(error: error).runModal() 140 | } 141 | } 142 | 143 | self.state = .Booted 144 | } 145 | 146 | func install() 147 | { 148 | let dispatchGroup = DispatchGroup() 149 | 150 | for simulator in self.simulators 151 | { 152 | DispatchQueue.global().async(group: dispatchGroup, qos: .userInitiated, flags: []) 153 | { 154 | do 155 | { 156 | try simulator.interact.installApplication(self.application!).launchApplication(self.launchConfiguration!).perform() 157 | } 158 | catch let error as NSError 159 | { 160 | DispatchQueue.main.async 161 | { 162 | NSAlert(error: error).runModal() 163 | } 164 | 165 | } 166 | } 167 | } 168 | 169 | _ = dispatchGroup.wait(timeout: DispatchTime.distantFuture) 170 | } 171 | 172 | func shutdown() 173 | { 174 | let dispatchGroup = DispatchGroup() 175 | 176 | for simulator in self.simulators 177 | { 178 | DispatchQueue.global().async(group: dispatchGroup, qos: .userInitiated, flags: []) 179 | { 180 | do 181 | { 182 | try simulator.interact.shutdownSimulator().perform() 183 | } 184 | catch let error as NSError 185 | { 186 | DispatchQueue.main.async { 187 | NSAlert(error: error).runModal() 188 | } 189 | } 190 | } 191 | } 192 | 193 | _ = dispatchGroup.wait(timeout: DispatchTime.distantFuture) 194 | 195 | self.simulators.removeAll() 196 | 197 | self.state = .Ready 198 | } 199 | } 200 | -------------------------------------------------------------------------------- /SimulatorController/Supporting Files/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.3 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 4 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSAppleScriptEnabled 28 | 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | OSAScriptingDefinition 34 | SimulatorController.sdef 35 | 36 | 37 | -------------------------------------------------------------------------------- /SimulatorController/Supporting Files/SimulatorController.sdef: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /SimulatorController/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SimulatorController 4 | // 5 | // Created by David Lawson on 5/03/2016. 6 | // 7 | 8 | import Cocoa 9 | 10 | class ViewController: NSViewController, DragDropViewDelegate 11 | { 12 | var simulatorController: SimulatorController! 13 | 14 | @IBOutlet weak var bootButton: NSButton! 15 | @IBOutlet weak var bootInstallButton: NSButton! 16 | @IBOutlet weak var installButton: NSButton! 17 | @IBOutlet weak var shutdownButton: NSButton! 18 | 19 | @IBOutlet weak var simulatorStackView: NSStackView! 20 | 21 | var hasApp = false 22 | var enabledSimulators: Set = [] 23 | var toggles: [NSButton] = [] 24 | 25 | override func viewDidLoad() 26 | { 27 | super.viewDidLoad() 28 | 29 | self.simulatorController = SimulatorController() 30 | 31 | NotificationCenter.default.addObserver(self, selector: #selector(ViewController.installAction(notification:)), name: InstallActionNotification, object: nil) 32 | 33 | for simType in SimulatorController.availableSimulators 34 | { 35 | let button = NSButton() 36 | button.setButtonType(.switch) 37 | button.alignment = .left 38 | button.imagePosition = .imageRight 39 | button.title = simType.rawValue 40 | button.target = self 41 | button.action = #selector(ViewController.toggledSimulator(button:)) 42 | self.toggles.append(button) 43 | self.simulatorStackView.addView(button, in: .top) 44 | self.simulatorStackView.addConstraint(NSLayoutConstraint(item: self.simulatorStackView, attribute: .width, relatedBy: .equal, toItem: button, attribute: .width, multiplier: 1, constant: 20)) 45 | } 46 | } 47 | 48 | deinit 49 | { 50 | NotificationCenter.default.removeObserver(self, name: InstallActionNotification, object: nil) 51 | } 52 | 53 | func dragDropViewGotURL(appURL: NSURL) 54 | { 55 | let plistURL = appURL.appendingPathComponent("Info.plist") 56 | let plist = NSDictionary(contentsOf: plistURL!)! 57 | 58 | let bundleID = plist["CFBundleIdentifier"] as! String 59 | let executable = plist["CFBundleExecutable"] as! String 60 | 61 | do 62 | { 63 | try self.simulatorController.setApplication(appURL: appURL, bundleID: bundleID, executable: executable) 64 | self.hasApp = true 65 | self.updateState() 66 | } 67 | catch let error as NSError 68 | { 69 | NSAlert(error: error).runModal() 70 | } 71 | } 72 | 73 | @IBAction func pressedBoot(sender: AnyObject) 74 | { 75 | self.simulatorController.boot(simulators: self.enabledSimulators) 76 | 77 | self.toggles.forEach { toggle in toggle.isEnabled = false } 78 | 79 | self.updateState() 80 | } 81 | 82 | @IBAction func pressedBootAndInstall(sender: AnyObject) 83 | { 84 | self.simulatorController.boot(simulators: self.enabledSimulators) 85 | self.simulatorController.install() 86 | 87 | self.toggles.forEach { toggle in toggle.isEnabled = false } 88 | 89 | self.updateState() 90 | } 91 | 92 | @IBAction func pressedInstall(sender: AnyObject) 93 | { 94 | self.simulatorController.install() 95 | } 96 | 97 | @IBAction func pressedShutdown(sender: AnyObject) 98 | { 99 | self.simulatorController.shutdown() 100 | 101 | self.toggles.forEach { toggle in toggle.isEnabled = true } 102 | 103 | self.updateState() 104 | } 105 | 106 | func updateState() 107 | { 108 | self.bootButton.isEnabled = self.enabledSimulators.count > 0 && self.hasApp && self.simulatorController.state == .Ready 109 | self.bootInstallButton.isEnabled = self.enabledSimulators.count > 0 && self.hasApp && self.simulatorController.state == .Ready 110 | self.installButton.isEnabled = self.simulatorController.state == .Booted 111 | self.shutdownButton.isEnabled = self.simulatorController.state == .Booted 112 | } 113 | 114 | func toggledSimulator(button: NSButton) 115 | { 116 | if button.state == NSOnState 117 | { 118 | self.enabledSimulators.insert(Simulator(rawValue: button.title)!) 119 | } 120 | else 121 | { 122 | self.enabledSimulators.remove(Simulator(rawValue: button.title)!) 123 | } 124 | 125 | self.updateState() 126 | } 127 | 128 | func installAction(notification: NSNotification) 129 | { 130 | if self.simulatorController.state == .Booted 131 | { 132 | self.simulatorController.install() 133 | } 134 | } 135 | } 136 | 137 | -------------------------------------------------------------------------------- /SimulatorController/WindowController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WindowController.swift 3 | // SimulatorController 4 | // 5 | // Created by David Lawson on 5/03/2016. 6 | // 7 | 8 | import Foundation 9 | import Cocoa 10 | 11 | class WindowController: NSWindowController 12 | { 13 | override func windowDidLoad() 14 | { 15 | super.windowDidLoad() 16 | self.window!.level = Int(CGWindowLevelForKey(.floatingWindow)) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/davidlawson/SimulatorController/bda519bd4dc5036061af6b64686afb81a87e0e19/screenshot.png --------------------------------------------------------------------------------