├── BouncingBalls ├── BouncingBalls.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── BouncingBalls.xccheckout │ │ └── xcuserdata │ │ │ └── timbert.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── timbert.xcuserdatad │ │ └── xcschemes │ │ ├── BouncingBalls.xcscheme │ │ └── xcschememanagement.plist ├── BouncingBalls │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── Main.storyboard │ ├── GameScene.sks │ ├── GameScene.swift │ ├── GameViewController.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── LaunchImage.launchimage │ │ │ └── Contents.json │ │ └── Spaceship.imageset │ │ │ ├── Contents.json │ │ │ └── Spaceship.png │ └── Info.plist └── BouncingBallsTests │ ├── BouncingBallsTests.swift │ └── Info.plist ├── DrawingText ├── DrawingText.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── DrawingText.xccheckout │ │ └── xcuserdata │ │ │ └── timbert.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── timbert.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── DrawingText.xcscheme │ │ └── xcschememanagement.plist ├── DrawingText │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── Main.storyboard │ ├── GameScene.sks │ ├── GameScene.swift │ ├── GameViewController.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── LaunchImage.launchimage │ │ │ └── Contents.json │ │ └── Spaceship.imageset │ │ │ ├── Contents.json │ │ │ └── Spaceship.png │ └── Info.plist └── DrawingTextTests │ ├── DrawingTextTests.swift │ └── Info.plist ├── FilterExample ├── .DS_Store ├── FilterExample.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── FilterExample.xccheckout │ │ └── xcuserdata │ │ │ └── timbert.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── timbert.xcuserdatad │ │ └── xcschemes │ │ ├── FilterExample.xcscheme │ │ └── xcschememanagement.plist ├── FilterExample │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── Main.storyboard │ ├── GameScene.sks │ ├── GameScene.swift │ ├── GameViewController.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── LaunchImage.launchimage │ │ │ └── Contents.json │ │ └── Spaceship.imageset │ │ │ ├── Contents.json │ │ │ └── Spaceship.png │ └── Info.plist └── FilterExampleTests │ ├── FilterExampleTests.swift │ └── Info.plist ├── PhysicsField ├── PhysicsField.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── PhysicsField.xccheckout │ │ └── xcuserdata │ │ │ └── timbert.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── timbert.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── PhysicsField.xcscheme │ │ └── xcschememanagement.plist ├── PhysicsField │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── Main.storyboard │ ├── GameScene.sks │ ├── GameScene.swift │ ├── GameViewController.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── LaunchImage.launchimage │ │ │ └── Contents.json │ │ └── Spaceship.imageset │ │ │ ├── Contents.json │ │ │ └── Spaceship.png │ └── Info.plist └── PhysicsFieldTests │ ├── Info.plist │ └── PhysicsFieldTests.swift ├── README.md ├── RemoteImage ├── RemoteImage.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── RemoteImage.xccheckout │ │ └── xcuserdata │ │ │ └── timbert.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── timbert.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── RemoteImage.xcscheme │ │ └── xcschememanagement.plist ├── RemoteImage │ ├── AppDelegate.swift │ ├── Base.lproj │ │ └── Main.storyboard │ ├── GameScene.sks │ ├── GameScene.swift │ ├── GameViewController.swift │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── LaunchImage.launchimage │ │ │ └── Contents.json │ │ └── Spaceship.imageset │ │ │ ├── Contents.json │ │ │ └── Spaceship.png │ └── Info.plist └── RemoteImageTests │ ├── Info.plist │ └── RemoteImageTests.swift └── RemoteJSON ├── RemoteJSON.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── RemoteJSON.xccheckout │ └── xcuserdata │ │ └── timbert.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── timbert.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── RemoteJSON.xcscheme │ └── xcschememanagement.plist ├── RemoteJSON ├── AppDelegate.swift ├── Base.lproj │ └── Main.storyboard ├── GameScene.sks ├── GameScene.swift ├── GameViewController.swift ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── LaunchImage.launchimage │ │ └── Contents.json │ └── Spaceship.imageset │ │ ├── Contents.json │ │ └── Spaceship.png └── Info.plist └── RemoteJSONTests ├── Info.plist └── RemoteJSONTests.swift /BouncingBalls/BouncingBalls.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0485514B1949585300E9591C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0485514A1949585300E9591C /* AppDelegate.swift */; }; 11 | 0485514D1949585300E9591C /* GameScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 0485514C1949585300E9591C /* GameScene.sks */; }; 12 | 0485514F1949585300E9591C /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0485514E1949585300E9591C /* GameScene.swift */; }; 13 | 048551511949585300E9591C /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048551501949585300E9591C /* GameViewController.swift */; }; 14 | 048551541949585300E9591C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 048551521949585300E9591C /* Main.storyboard */; }; 15 | 048551561949585300E9591C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 048551551949585300E9591C /* Images.xcassets */; }; 16 | 048551621949585300E9591C /* BouncingBallsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048551611949585300E9591C /* BouncingBallsTests.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 0485515C1949585300E9591C /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 0485513D1949585300E9591C /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 048551441949585300E9591C; 25 | remoteInfo = BouncingBalls; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 048551451949585300E9591C /* BouncingBalls.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BouncingBalls.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 048551491949585300E9591C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 0485514A1949585300E9591C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | 0485514C1949585300E9591C /* GameScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = GameScene.sks; sourceTree = ""; }; 34 | 0485514E1949585300E9591C /* GameScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = ""; }; 35 | 048551501949585300E9591C /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = ""; }; 36 | 048551531949585300E9591C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | 048551551949585300E9591C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | 0485515B1949585300E9591C /* BouncingBallsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BouncingBallsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 048551601949585300E9591C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 048551611949585300E9591C /* BouncingBallsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BouncingBallsTests.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 048551421949585300E9591C /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | 048551581949585300E9591C /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 0485513C1949585300E9591C = { 62 | isa = PBXGroup; 63 | children = ( 64 | 048551471949585300E9591C /* BouncingBalls */, 65 | 0485515E1949585300E9591C /* BouncingBallsTests */, 66 | 048551461949585300E9591C /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 048551461949585300E9591C /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 048551451949585300E9591C /* BouncingBalls.app */, 74 | 0485515B1949585300E9591C /* BouncingBallsTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 048551471949585300E9591C /* BouncingBalls */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 0485514A1949585300E9591C /* AppDelegate.swift */, 83 | 0485514C1949585300E9591C /* GameScene.sks */, 84 | 0485514E1949585300E9591C /* GameScene.swift */, 85 | 048551501949585300E9591C /* GameViewController.swift */, 86 | 048551521949585300E9591C /* Main.storyboard */, 87 | 048551551949585300E9591C /* Images.xcassets */, 88 | 048551481949585300E9591C /* Supporting Files */, 89 | ); 90 | path = BouncingBalls; 91 | sourceTree = ""; 92 | }; 93 | 048551481949585300E9591C /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 048551491949585300E9591C /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | 0485515E1949585300E9591C /* BouncingBallsTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 048551611949585300E9591C /* BouncingBallsTests.swift */, 105 | 0485515F1949585300E9591C /* Supporting Files */, 106 | ); 107 | path = BouncingBallsTests; 108 | sourceTree = ""; 109 | }; 110 | 0485515F1949585300E9591C /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 048551601949585300E9591C /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | 048551441949585300E9591C /* BouncingBalls */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = 048551651949585300E9591C /* Build configuration list for PBXNativeTarget "BouncingBalls" */; 124 | buildPhases = ( 125 | 048551411949585300E9591C /* Sources */, 126 | 048551421949585300E9591C /* Frameworks */, 127 | 048551431949585300E9591C /* Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = BouncingBalls; 134 | productName = BouncingBalls; 135 | productReference = 048551451949585300E9591C /* BouncingBalls.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | 0485515A1949585300E9591C /* BouncingBallsTests */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 048551681949585300E9591C /* Build configuration list for PBXNativeTarget "BouncingBallsTests" */; 141 | buildPhases = ( 142 | 048551571949585300E9591C /* Sources */, 143 | 048551581949585300E9591C /* Frameworks */, 144 | 048551591949585300E9591C /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | 0485515D1949585300E9591C /* PBXTargetDependency */, 150 | ); 151 | name = BouncingBallsTests; 152 | productName = BouncingBallsTests; 153 | productReference = 0485515B1949585300E9591C /* BouncingBallsTests.xctest */; 154 | productType = "com.apple.product-type.bundle.unit-test"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | 0485513D1949585300E9591C /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 0600; 163 | ORGANIZATIONNAME = "Thibault Imbert"; 164 | TargetAttributes = { 165 | 048551441949585300E9591C = { 166 | CreatedOnToolsVersion = 6.0; 167 | }; 168 | 0485515A1949585300E9591C = { 169 | CreatedOnToolsVersion = 6.0; 170 | TestTargetID = 048551441949585300E9591C; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = 048551401949585300E9591C /* Build configuration list for PBXProject "BouncingBalls" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = 0485513C1949585300E9591C; 183 | productRefGroup = 048551461949585300E9591C /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | 048551441949585300E9591C /* BouncingBalls */, 188 | 0485515A1949585300E9591C /* BouncingBallsTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | 048551431949585300E9591C /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | 048551561949585300E9591C /* Images.xcassets in Resources */, 199 | 0485514D1949585300E9591C /* GameScene.sks in Resources */, 200 | 048551541949585300E9591C /* Main.storyboard in Resources */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | 048551591949585300E9591C /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXResourcesBuildPhase section */ 212 | 213 | /* Begin PBXSourcesBuildPhase section */ 214 | 048551411949585300E9591C /* Sources */ = { 215 | isa = PBXSourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 0485514F1949585300E9591C /* GameScene.swift in Sources */, 219 | 048551511949585300E9591C /* GameViewController.swift in Sources */, 220 | 0485514B1949585300E9591C /* AppDelegate.swift in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | 048551571949585300E9591C /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 048551621949585300E9591C /* BouncingBallsTests.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXTargetDependency section */ 235 | 0485515D1949585300E9591C /* PBXTargetDependency */ = { 236 | isa = PBXTargetDependency; 237 | target = 048551441949585300E9591C /* BouncingBalls */; 238 | targetProxy = 0485515C1949585300E9591C /* PBXContainerItemProxy */; 239 | }; 240 | /* End PBXTargetDependency section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | 048551521949585300E9591C /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 048551531949585300E9591C /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 048551631949585300E9591C /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ALWAYS_SEARCH_USER_PATHS = NO; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu99; 275 | GCC_DYNAMIC_NO_PIC = NO; 276 | GCC_OPTIMIZATION_LEVEL = 0; 277 | GCC_PREPROCESSOR_DEFINITIONS = ( 278 | "DEBUG=1", 279 | "$(inherited)", 280 | ); 281 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 284 | GCC_WARN_UNDECLARED_SELECTOR = YES; 285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 286 | GCC_WARN_UNUSED_FUNCTION = YES; 287 | GCC_WARN_UNUSED_VARIABLE = YES; 288 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 289 | METAL_ENABLE_DEBUG_INFO = YES; 290 | ONLY_ACTIVE_ARCH = YES; 291 | SDKROOT = iphoneos; 292 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 293 | TARGETED_DEVICE_FAMILY = "1,2"; 294 | }; 295 | name = Debug; 296 | }; 297 | 048551641949585300E9591C /* Release */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ALWAYS_SEARCH_USER_PATHS = NO; 301 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 302 | CLANG_CXX_LIBRARY = "libc++"; 303 | CLANG_ENABLE_MODULES = YES; 304 | CLANG_ENABLE_OBJC_ARC = YES; 305 | CLANG_WARN_BOOL_CONVERSION = YES; 306 | CLANG_WARN_CONSTANT_CONVERSION = YES; 307 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 308 | CLANG_WARN_EMPTY_BODY = YES; 309 | CLANG_WARN_ENUM_CONVERSION = YES; 310 | CLANG_WARN_INT_CONVERSION = YES; 311 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 312 | CLANG_WARN_UNREACHABLE_CODE = YES; 313 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 314 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 315 | COPY_PHASE_STRIP = YES; 316 | ENABLE_NS_ASSERTIONS = NO; 317 | ENABLE_STRICT_OBJC_MSGSEND = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu99; 319 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 320 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 321 | GCC_WARN_UNDECLARED_SELECTOR = YES; 322 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 323 | GCC_WARN_UNUSED_FUNCTION = YES; 324 | GCC_WARN_UNUSED_VARIABLE = YES; 325 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 326 | METAL_ENABLE_DEBUG_INFO = NO; 327 | SDKROOT = iphoneos; 328 | TARGETED_DEVICE_FAMILY = "1,2"; 329 | VALIDATE_PRODUCT = YES; 330 | }; 331 | name = Release; 332 | }; 333 | 048551661949585300E9591C /* Debug */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 337 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 338 | INFOPLIST_FILE = BouncingBalls/Info.plist; 339 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 340 | PRODUCT_NAME = "$(TARGET_NAME)"; 341 | }; 342 | name = Debug; 343 | }; 344 | 048551671949585300E9591C /* Release */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 348 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 349 | INFOPLIST_FILE = BouncingBalls/Info.plist; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | }; 353 | name = Release; 354 | }; 355 | 048551691949585300E9591C /* Debug */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/BouncingBalls.app/BouncingBalls"; 359 | FRAMEWORK_SEARCH_PATHS = ( 360 | "$(SDKROOT)/Developer/Library/Frameworks", 361 | "$(inherited)", 362 | ); 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | INFOPLIST_FILE = BouncingBallsTests/Info.plist; 368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 369 | METAL_ENABLE_DEBUG_INFO = YES; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | TEST_HOST = "$(BUNDLE_LOADER)"; 372 | }; 373 | name = Debug; 374 | }; 375 | 0485516A1949585300E9591C /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/BouncingBalls.app/BouncingBalls"; 379 | FRAMEWORK_SEARCH_PATHS = ( 380 | "$(SDKROOT)/Developer/Library/Frameworks", 381 | "$(inherited)", 382 | ); 383 | INFOPLIST_FILE = BouncingBallsTests/Info.plist; 384 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 385 | METAL_ENABLE_DEBUG_INFO = NO; 386 | PRODUCT_NAME = "$(TARGET_NAME)"; 387 | TEST_HOST = "$(BUNDLE_LOADER)"; 388 | }; 389 | name = Release; 390 | }; 391 | /* End XCBuildConfiguration section */ 392 | 393 | /* Begin XCConfigurationList section */ 394 | 048551401949585300E9591C /* Build configuration list for PBXProject "BouncingBalls" */ = { 395 | isa = XCConfigurationList; 396 | buildConfigurations = ( 397 | 048551631949585300E9591C /* Debug */, 398 | 048551641949585300E9591C /* Release */, 399 | ); 400 | defaultConfigurationIsVisible = 0; 401 | defaultConfigurationName = Release; 402 | }; 403 | 048551651949585300E9591C /* Build configuration list for PBXNativeTarget "BouncingBalls" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | 048551661949585300E9591C /* Debug */, 407 | 048551671949585300E9591C /* Release */, 408 | ); 409 | defaultConfigurationIsVisible = 0; 410 | }; 411 | 048551681949585300E9591C /* Build configuration list for PBXNativeTarget "BouncingBallsTests" */ = { 412 | isa = XCConfigurationList; 413 | buildConfigurations = ( 414 | 048551691949585300E9591C /* Debug */, 415 | 0485516A1949585300E9591C /* Release */, 416 | ); 417 | defaultConfigurationIsVisible = 0; 418 | }; 419 | /* End XCConfigurationList section */ 420 | }; 421 | rootObject = 0485513D1949585300E9591C /* Project object */; 422 | } 423 | -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls.xcodeproj/project.xcworkspace/xcshareddata/BouncingBalls.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 0B48CB2A-E230-4E24-91B3-C38F10AE00A8 9 | IDESourceControlProjectName 10 | BouncingBalls 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 14 | https://github.com/thibaultimbert/swift-experiments.git 15 | 16 | IDESourceControlProjectPath 17 | BouncingBalls/BouncingBalls.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/thibaultimbert/swift-experiments.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 36 | IDESourceControlWCCName 37 | swift-experiments 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/BouncingBalls/BouncingBalls.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/BouncingBalls.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BouncingBalls.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 048551441949585300E9591C 16 | 17 | primary 18 | 19 | 20 | 0485515A1949585300E9591C 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // BouncingBalls 4 | // 5 | // Created by Thibault Imbert on 2014-06-11. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/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 | -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/GameScene.sks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/BouncingBalls/BouncingBalls/GameScene.sks -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/GameScene.swift: -------------------------------------------------------------------------------- 1 | // Consider this your Main class, basically the Stage 2 | // Note: The code below is for iOS, you can run it with the iOS simulator 3 | 4 | // this imports higher level APIs like Starling 5 | import SpriteKit 6 | 7 | // canvas size for the positioning 8 | let canvasWidth: UInt32 = 800 9 | let canvasHeight: UInt32 = 800 10 | 11 | // our main logic inside this class 12 | // we subclass the SKScene class by using the :TheType syntax below 13 | class GameScene: SKScene { 14 | 15 | // this gets triggered automatically when presented to the view, put initialization logic here 16 | override func didMoveToView(view: SKView) { 17 | 18 | // we set the background color to black, self is the equivalent of this in Flash 19 | self.scene?.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1) 20 | 21 | // we live in a world with gravity on the y axis 22 | self.physicsWorld.gravity = CGVectorMake(0, -6) 23 | // we put contraints on the top, left, right, bottom so that our balls can bounce off them 24 | let physicsBody = SKPhysicsBody (edgeLoopFromRect: self.frame) 25 | // we set the body defining the physics to our scene 26 | self.physicsBody = physicsBody 27 | 28 | // let's create 20 bouncing balls 29 | for i in 1...30 { 30 | 31 | // SkShapeNode is a primitive for drawing like with the AS3 Drawing API 32 | // it has built in support for primitives like a circle, so we pass a radius 33 | let shape = SKShapeNode(circleOfRadius: 20) 34 | // we set the color and line style 35 | shape.strokeColor = UIColor(red: 255, green: 0, blue: 0, alpha: 0.5) 36 | shape.lineWidth = 4 37 | // we create a text node to embed text in our ball 38 | let text = SKLabelNode(text: String(i)) 39 | // we set the font 40 | text.fontSize = 9.0 41 | // we nest the text label in our ball 42 | shape.addChild(text) 43 | 44 | // we set initial random positions 45 | shape.position = CGPoint (x: CGFloat(arc4random()%(canvasWidth)), y: CGFloat(arc4random()%(canvasHeight))) 46 | // we add each circle to the display list 47 | self.addChild(shape) 48 | 49 | // this is the most important line, we define the body 50 | shape.physicsBody = SKPhysicsBody(circleOfRadius: shape.frame.size.width/2) 51 | // this defines the mass, roughness and bounciness 52 | shape.physicsBody?.friction = 0.3 53 | shape.physicsBody?.restitution = 0.8 54 | shape.physicsBody?.mass = 0.5 55 | // this will allow the balls to rotate when bouncing off each other 56 | shape.physicsBody?.allowsRotation = true 57 | } 58 | } 59 | 60 | // magic of the physics engine, we don't have to do anything here 61 | override func update(currentTime: CFTimeInterval) { 62 | } 63 | } -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/GameViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameViewController.swift 3 | // BouncingBalls 4 | // 5 | // Created by Thibault Imbert on 2014-06-11. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SpriteKit 11 | 12 | extension SKNode { 13 | class func unarchiveFromFile(file : NSString) -> SKNode? { 14 | if let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks") { 15 | var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)! 16 | var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData) 17 | 18 | archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene") 19 | let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene 20 | archiver.finishDecoding() 21 | return scene 22 | } else { 23 | return nil 24 | } 25 | } 26 | } 27 | 28 | class GameViewController: UIViewController { 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | 33 | if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene { 34 | // Configure the view. 35 | let skView = self.view as SKView 36 | skView.showsFPS = true 37 | skView.showsNodeCount = true 38 | 39 | /* Sprite Kit applies additional optimizations to improve rendering performance */ 40 | skView.ignoresSiblingOrder = true 41 | 42 | /* Set the scale mode to scale to fit the window */ 43 | scene.scaleMode = .AspectFill 44 | 45 | skView.presentScene(scene) 46 | } 47 | } 48 | 49 | override func shouldAutorotate() -> Bool { 50 | return true 51 | } 52 | 53 | override func supportedInterfaceOrientations() -> Int { 54 | if UIDevice.currentDevice().userInterfaceIdiom == .Phone { 55 | return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue) 56 | } else { 57 | return Int(UIInterfaceOrientationMask.All.rawValue) 58 | } 59 | } 60 | 61 | override func didReceiveMemoryWarning() { 62 | super.didReceiveMemoryWarning() 63 | // Release any cached data, images, etc that aren't in use. 64 | } 65 | 66 | override func prefersStatusBarHidden() -> Bool { 67 | return true 68 | } 69 | } -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/Images.xcassets/Spaceship.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Spaceship.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/Images.xcassets/Spaceship.imageset/Spaceship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/BouncingBalls/BouncingBalls/Images.xcassets/Spaceship.imageset/Spaceship.png -------------------------------------------------------------------------------- /BouncingBalls/BouncingBalls/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /BouncingBalls/BouncingBallsTests/BouncingBallsTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BouncingBallsTests.swift 3 | // BouncingBallsTests 4 | // 5 | // Created by Thibault Imbert on 2014-06-11. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class BouncingBallsTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /BouncingBalls/BouncingBallsTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /DrawingText/DrawingText.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DrawingText/DrawingText.xcodeproj/project.xcworkspace/xcshareddata/DrawingText.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 0196158F-CBDF-4437-9AEA-980847845A4E 9 | IDESourceControlProjectName 10 | DrawingText 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 14 | https://github.com/thibaultimbert/swift-experiments.git 15 | 16 | IDESourceControlProjectPath 17 | DrawingText/DrawingText.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/thibaultimbert/swift-experiments.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 36 | IDESourceControlWCCName 37 | swift-experiments 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /DrawingText/DrawingText.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/DrawingText/DrawingText.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DrawingText/DrawingText.xcodeproj/xcuserdata/timbert.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /DrawingText/DrawingText.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/DrawingText.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /DrawingText/DrawingText.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DrawingText.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 04E1D3211951405B0082FF22 16 | 17 | primary 18 | 19 | 20 | 04E1D3371951405B0082FF22 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /DrawingText/DrawingText/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DrawingText 4 | // 5 | // Created by Thibault Imbert on 2014-06-17. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /DrawingText/DrawingText/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 | -------------------------------------------------------------------------------- /DrawingText/DrawingText/GameScene.sks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/DrawingText/DrawingText/GameScene.sks -------------------------------------------------------------------------------- /DrawingText/DrawingText/GameScene.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameScene.swift 3 | // DrawingText 4 | // 5 | // Created by Thibault Imbert on 2014-06-17. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import SpriteKit 10 | 11 | class GameScene: SKScene { 12 | override func didMoveToView(view: SKView) { 13 | 14 | // our string, note that we use here NSString instead of String that has more APIs like drawInRect and size 15 | // it is preferred to use Swift native rypes like String but for now String has a limited API surface 16 | let text: NSString = "Copyright © - Thibault Imbert" 17 | 18 | // we reference our image (path) 19 | let data = NSData (contentsOfFile: "/Users/timbert/Documents/Ayden.jpg") 20 | 21 | // we create a UIImage out of it 22 | if let image = UIImage(data: data!) { 23 | 24 | // our rectangle for the drawing size 25 | let rect = CGRectMake(0, 0, image.size.width, image.size.height) 26 | 27 | // we create our graphics context at the size of our image 28 | UIGraphicsBeginImageContextWithOptions(CGSize(width: rect.width, height: rect.height), true, 0) 29 | 30 | // we retrieve it 31 | let context = UIGraphicsGetCurrentContext() 32 | 33 | // our color 34 | let color = CGColorCreate(CGColorSpaceCreateDeviceRGB(), [1.0, 0.5, 0.5, 0.2]) 35 | 36 | // we set our color to white (this will be the text color) 37 | CGContextSetFillColorWithColor(context, color) 38 | 39 | // we draw our image to the graphics context 40 | image.drawInRect(rect) 41 | 42 | // we pick the font we want to use 43 | if let font = UIFont(name: "Arial", size: 18) { 44 | 45 | // a dictionary informing about the font used, required by sizeWithAttributes to query the text size 46 | let attr = [NSFontAttributeName: font] 47 | 48 | // the size of our text 49 | let size = text.sizeWithAttributes(attr) 50 | 51 | // the rect for the drawing position of our copyright text message 52 | let rectText = CGRectMake(image.size.width-size.width, image.size.height-(size.height+4), image.size.width-(size.width+4), image.size.height) 53 | 54 | // we draw the text on the graphics context, with our font 55 | text.drawInRect(rectText, withAttributes: attr) 56 | 57 | // we grab a UIImage from the graphics context 58 | let newImage = UIGraphicsGetImageFromCurrentImageContext(); 59 | 60 | // we remove our bitmap from the stack 61 | UIGraphicsEndImageContext(); 62 | 63 | // we create a texture, pass the UIImage 64 | var texture = SKTexture(image: newImage) 65 | 66 | // wrap it inside a sprite node 67 | var sprite = SKSpriteNode(texture:texture) 68 | 69 | // we scale it a bit 70 | sprite.setScale(0.5); 71 | 72 | // we position it 73 | sprite.position = CGPoint (x: 510, y: 300) 74 | 75 | // let's display it 76 | self.addChild(sprite) 77 | } 78 | } 79 | } 80 | 81 | override func touchesBegan(touches: NSSet, withEvent event: UIEvent) { 82 | } 83 | 84 | override func update(currentTime: CFTimeInterval) { 85 | /* Called before each frame is rendered */ 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /DrawingText/DrawingText/GameViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameViewController.swift 3 | // DrawingText 4 | // 5 | // Created by Thibault Imbert on 2014-06-17. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SpriteKit 11 | 12 | extension SKNode { 13 | class func unarchiveFromFile(file : NSString) -> SKNode? { 14 | if let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks") { 15 | var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)! 16 | var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData) 17 | 18 | archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene") 19 | let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene 20 | archiver.finishDecoding() 21 | return scene 22 | } else { 23 | return nil 24 | } 25 | } 26 | } 27 | 28 | class GameViewController: UIViewController { 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | 33 | if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene { 34 | // Configure the view. 35 | let skView = self.view as SKView 36 | skView.showsFPS = true 37 | skView.showsNodeCount = true 38 | 39 | /* Sprite Kit applies additional optimizations to improve rendering performance */ 40 | skView.ignoresSiblingOrder = true 41 | 42 | /* Set the scale mode to scale to fit the window */ 43 | scene.scaleMode = .AspectFill 44 | 45 | skView.presentScene(scene) 46 | } 47 | } 48 | 49 | override func shouldAutorotate() -> Bool { 50 | return true 51 | } 52 | 53 | override func supportedInterfaceOrientations() -> Int { 54 | if UIDevice.currentDevice().userInterfaceIdiom == .Phone { 55 | return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue) 56 | } else { 57 | return Int(UIInterfaceOrientationMask.All.rawValue) 58 | } 59 | } 60 | 61 | override func didReceiveMemoryWarning() { 62 | super.didReceiveMemoryWarning() 63 | // Release any cached data, images, etc that aren't in use. 64 | } 65 | 66 | override func prefersStatusBarHidden() -> Bool { 67 | return true 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /DrawingText/DrawingText/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /DrawingText/DrawingText/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /DrawingText/DrawingText/Images.xcassets/Spaceship.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Spaceship.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /DrawingText/DrawingText/Images.xcassets/Spaceship.imageset/Spaceship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/DrawingText/DrawingText/Images.xcassets/Spaceship.imageset/Spaceship.png -------------------------------------------------------------------------------- /DrawingText/DrawingText/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /DrawingText/DrawingTextTests/DrawingTextTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DrawingTextTests.swift 3 | // DrawingTextTests 4 | // 5 | // Created by Thibault Imbert on 2014-06-17. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class DrawingTextTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /DrawingText/DrawingTextTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /FilterExample/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/FilterExample/.DS_Store -------------------------------------------------------------------------------- /FilterExample/FilterExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FilterExample/FilterExample.xcodeproj/project.xcworkspace/xcshareddata/FilterExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 4344D29D-B58C-4695-AAF5-099377A3F61D 9 | IDESourceControlProjectName 10 | FilterExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | C7C0346EC6E6F63DA4F37CE0126863678180FF35 14 | https://github.com/thibaultimbert/swift-experiments.git 15 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 16 | https://github.com/thibaultimbert/swift-experiments.git 17 | 18 | IDESourceControlProjectPath 19 | FilterExample.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | C7C0346EC6E6F63DA4F37CE0126863678180FF35 23 | ../.. 24 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 25 | ../../.. 26 | 27 | IDESourceControlProjectURL 28 | https://github.com/thibaultimbert/swift-experiments.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | C7C0346EC6E6F63DA4F37CE0126863678180FF35 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 40 | IDESourceControlWCCName 41 | 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | C7C0346EC6E6F63DA4F37CE0126863678180FF35 48 | IDESourceControlWCCName 49 | FilterExample 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /FilterExample/FilterExample.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/FilterExample/FilterExample.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /FilterExample/FilterExample.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/FilterExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /FilterExample/FilterExample.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FilterExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 048550E6194837BD00E9591C 16 | 17 | primary 18 | 19 | 20 | 048550FC194837BD00E9591C 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /FilterExample/FilterExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // FilterExample 4 | // 5 | // Created by Thibault Imbert on 2014-06-11. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /FilterExample/FilterExample/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 | -------------------------------------------------------------------------------- /FilterExample/FilterExample/GameScene.sks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/FilterExample/FilterExample/GameScene.sks -------------------------------------------------------------------------------- /FilterExample/FilterExample/GameScene.swift: -------------------------------------------------------------------------------- 1 | import SpriteKit 2 | 3 | class GameScene: SKScene { 4 | override func didMoveToView(view: SKView) { 5 | /* Setup your scene here */ 6 | 7 | // we create the graphics context 8 | UIGraphicsBeginImageContextWithOptions(CGSize(width: 200, height: 200), true, 1) 9 | 10 | // we retrieve it 11 | let context = UIGraphicsGetCurrentContext() 12 | 13 | // we issue drawing commands 14 | CGContextSetRGBFillColor (context, 1, 1, 0, 1); 15 | CGContextFillRect (context, CGRectMake (0, 0, 200, 200));// 4 16 | CGContextSetRGBFillColor (context, 1, 0, 0, 1);// 3 17 | CGContextFillRect (context, CGRectMake (0, 0, 100, 100));// 4 18 | CGContextSetRGBFillColor (context, 1, 1, 0, 1);// 3 19 | CGContextFillRect (context, CGRectMake (0, 0, 50, 50));// 4 20 | CGContextSetRGBFillColor (context, 0, 0, 1, 0.5);// 5 21 | CGContextFillRect (context, CGRectMake (0, 0, 50, 100)); 22 | 23 | // we query an image from it 24 | let image = UIGraphicsGetImageFromCurrentImageContext() 25 | 26 | // we create Core Image context 27 | let ciContext = CIContext(options: nil) 28 | // we create a CIImage, think of a CIImage as image data for processing, nothing is displayed or can be displayed at this point 29 | let coreImage = CIImage(image: image) 30 | // we pick the filter we want 31 | let filter = CIFilter(name: "CIGaussianBlur") 32 | // we pass our image as input 33 | filter.setValue(coreImage, forKey: kCIInputImageKey) 34 | // we retrieve the processed image 35 | let filteredImageData = filter.valueForKey(kCIOutputImageKey) as CIImage 36 | // returns a Quartz image from the Core Image context 37 | let filteredImageRef = ciContext.createCGImage(filteredImageData, fromRect: filteredImageData.extent()) 38 | // this is our final UIImage ready to be displayed 39 | let filteredImage = UIImage(CGImage: filteredImageRef); 40 | 41 | // we create a texture, pass the UIImage 42 | let texture = SKTexture(image: filteredImage!) 43 | // wrap it inside a sprite node 44 | let sprite = SKSpriteNode(texture:texture) 45 | // we scale it a bit 46 | sprite.setScale(0.5); 47 | // we position it 48 | sprite.position = CGPoint (x: 510, y: 380) 49 | // let's display it 50 | self.addChild(sprite) 51 | } 52 | 53 | override func update(currentTime: CFTimeInterval) { 54 | /* Called before each frame is rendered */ 55 | } 56 | } -------------------------------------------------------------------------------- /FilterExample/FilterExample/GameViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameViewController.swift 3 | // FilterExample 4 | // 5 | // Created by Thibault Imbert on 2014-06-11. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SpriteKit 11 | 12 | extension SKNode { 13 | class func unarchiveFromFile(file : NSString) -> SKNode? { 14 | if let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks") { 15 | var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)! 16 | var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData) 17 | 18 | archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene") 19 | let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene 20 | archiver.finishDecoding() 21 | return scene 22 | } else { 23 | return nil 24 | } 25 | } 26 | } 27 | 28 | class GameViewController: UIViewController { 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | 33 | if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene { 34 | // Configure the view. 35 | let skView = self.view as SKView 36 | skView.showsFPS = true 37 | skView.showsNodeCount = true 38 | 39 | /* Sprite Kit applies additional optimizations to improve rendering performance */ 40 | skView.ignoresSiblingOrder = true 41 | 42 | /* Set the scale mode to scale to fit the window */ 43 | scene.scaleMode = .AspectFill 44 | 45 | skView.presentScene(scene) 46 | } 47 | } 48 | 49 | override func shouldAutorotate() -> Bool { 50 | return true 51 | } 52 | 53 | override func supportedInterfaceOrientations() -> Int { 54 | if UIDevice.currentDevice().userInterfaceIdiom == .Phone { 55 | return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue) 56 | } else { 57 | return Int(UIInterfaceOrientationMask.All.rawValue) 58 | } 59 | } 60 | 61 | override func didReceiveMemoryWarning() { 62 | super.didReceiveMemoryWarning() 63 | // Release any cached data, images, etc that aren't in use. 64 | } 65 | 66 | override func prefersStatusBarHidden() -> Bool { 67 | return true 68 | } 69 | } -------------------------------------------------------------------------------- /FilterExample/FilterExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /FilterExample/FilterExample/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /FilterExample/FilterExample/Images.xcassets/Spaceship.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Spaceship.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /FilterExample/FilterExample/Images.xcassets/Spaceship.imageset/Spaceship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/FilterExample/FilterExample/Images.xcassets/Spaceship.imageset/Spaceship.png -------------------------------------------------------------------------------- /FilterExample/FilterExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /FilterExample/FilterExampleTests/FilterExampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FilterExampleTests.swift 3 | // FilterExampleTests 4 | // 5 | // Created by Thibault Imbert on 2014-06-11. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class FilterExampleTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /FilterExample/FilterExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsField.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0485511C1949570400E9591C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0485511B1949570400E9591C /* AppDelegate.swift */; }; 11 | 0485511E1949570400E9591C /* GameScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 0485511D1949570400E9591C /* GameScene.sks */; }; 12 | 048551201949570400E9591C /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0485511F1949570400E9591C /* GameScene.swift */; }; 13 | 048551221949570400E9591C /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048551211949570400E9591C /* GameViewController.swift */; }; 14 | 048551251949570400E9591C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 048551231949570400E9591C /* Main.storyboard */; }; 15 | 048551271949570400E9591C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 048551261949570400E9591C /* Images.xcassets */; }; 16 | 048551331949570400E9591C /* PhysicsFieldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048551321949570400E9591C /* PhysicsFieldTests.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 0485512D1949570400E9591C /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 0485510E1949570400E9591C /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 048551151949570400E9591C; 25 | remoteInfo = PhysicsField; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 048551161949570400E9591C /* PhysicsField.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PhysicsField.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 0485511A1949570400E9591C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 0485511B1949570400E9591C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | 0485511D1949570400E9591C /* GameScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = GameScene.sks; sourceTree = ""; }; 34 | 0485511F1949570400E9591C /* GameScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = ""; }; 35 | 048551211949570400E9591C /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = ""; }; 36 | 048551241949570400E9591C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | 048551261949570400E9591C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | 0485512C1949570400E9591C /* PhysicsFieldTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PhysicsFieldTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 048551311949570400E9591C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 048551321949570400E9591C /* PhysicsFieldTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhysicsFieldTests.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 048551131949570400E9591C /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | 048551291949570400E9591C /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 0485510D1949570400E9591C = { 62 | isa = PBXGroup; 63 | children = ( 64 | 048551181949570400E9591C /* PhysicsField */, 65 | 0485512F1949570400E9591C /* PhysicsFieldTests */, 66 | 048551171949570400E9591C /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 048551171949570400E9591C /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 048551161949570400E9591C /* PhysicsField.app */, 74 | 0485512C1949570400E9591C /* PhysicsFieldTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 048551181949570400E9591C /* PhysicsField */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 0485511B1949570400E9591C /* AppDelegate.swift */, 83 | 0485511D1949570400E9591C /* GameScene.sks */, 84 | 0485511F1949570400E9591C /* GameScene.swift */, 85 | 048551211949570400E9591C /* GameViewController.swift */, 86 | 048551231949570400E9591C /* Main.storyboard */, 87 | 048551261949570400E9591C /* Images.xcassets */, 88 | 048551191949570400E9591C /* Supporting Files */, 89 | ); 90 | path = PhysicsField; 91 | sourceTree = ""; 92 | }; 93 | 048551191949570400E9591C /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 0485511A1949570400E9591C /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | 0485512F1949570400E9591C /* PhysicsFieldTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 048551321949570400E9591C /* PhysicsFieldTests.swift */, 105 | 048551301949570400E9591C /* Supporting Files */, 106 | ); 107 | path = PhysicsFieldTests; 108 | sourceTree = ""; 109 | }; 110 | 048551301949570400E9591C /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 048551311949570400E9591C /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | 048551151949570400E9591C /* PhysicsField */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = 048551361949570400E9591C /* Build configuration list for PBXNativeTarget "PhysicsField" */; 124 | buildPhases = ( 125 | 048551121949570400E9591C /* Sources */, 126 | 048551131949570400E9591C /* Frameworks */, 127 | 048551141949570400E9591C /* Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = PhysicsField; 134 | productName = PhysicsField; 135 | productReference = 048551161949570400E9591C /* PhysicsField.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | 0485512B1949570400E9591C /* PhysicsFieldTests */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 048551391949570400E9591C /* Build configuration list for PBXNativeTarget "PhysicsFieldTests" */; 141 | buildPhases = ( 142 | 048551281949570400E9591C /* Sources */, 143 | 048551291949570400E9591C /* Frameworks */, 144 | 0485512A1949570400E9591C /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | 0485512E1949570400E9591C /* PBXTargetDependency */, 150 | ); 151 | name = PhysicsFieldTests; 152 | productName = PhysicsFieldTests; 153 | productReference = 0485512C1949570400E9591C /* PhysicsFieldTests.xctest */; 154 | productType = "com.apple.product-type.bundle.unit-test"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | 0485510E1949570400E9591C /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 0600; 163 | ORGANIZATIONNAME = "Thibault Imbert"; 164 | TargetAttributes = { 165 | 048551151949570400E9591C = { 166 | CreatedOnToolsVersion = 6.0; 167 | }; 168 | 0485512B1949570400E9591C = { 169 | CreatedOnToolsVersion = 6.0; 170 | TestTargetID = 048551151949570400E9591C; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = 048551111949570400E9591C /* Build configuration list for PBXProject "PhysicsField" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = 0485510D1949570400E9591C; 183 | productRefGroup = 048551171949570400E9591C /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | 048551151949570400E9591C /* PhysicsField */, 188 | 0485512B1949570400E9591C /* PhysicsFieldTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | 048551141949570400E9591C /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | 048551271949570400E9591C /* Images.xcassets in Resources */, 199 | 0485511E1949570400E9591C /* GameScene.sks in Resources */, 200 | 048551251949570400E9591C /* Main.storyboard in Resources */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | 0485512A1949570400E9591C /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXResourcesBuildPhase section */ 212 | 213 | /* Begin PBXSourcesBuildPhase section */ 214 | 048551121949570400E9591C /* Sources */ = { 215 | isa = PBXSourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 048551201949570400E9591C /* GameScene.swift in Sources */, 219 | 048551221949570400E9591C /* GameViewController.swift in Sources */, 220 | 0485511C1949570400E9591C /* AppDelegate.swift in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | 048551281949570400E9591C /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 048551331949570400E9591C /* PhysicsFieldTests.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXTargetDependency section */ 235 | 0485512E1949570400E9591C /* PBXTargetDependency */ = { 236 | isa = PBXTargetDependency; 237 | target = 048551151949570400E9591C /* PhysicsField */; 238 | targetProxy = 0485512D1949570400E9591C /* PBXContainerItemProxy */; 239 | }; 240 | /* End PBXTargetDependency section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | 048551231949570400E9591C /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 048551241949570400E9591C /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 048551341949570400E9591C /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ALWAYS_SEARCH_USER_PATHS = NO; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu99; 275 | GCC_DYNAMIC_NO_PIC = NO; 276 | GCC_OPTIMIZATION_LEVEL = 0; 277 | GCC_PREPROCESSOR_DEFINITIONS = ( 278 | "DEBUG=1", 279 | "$(inherited)", 280 | ); 281 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 284 | GCC_WARN_UNDECLARED_SELECTOR = YES; 285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 286 | GCC_WARN_UNUSED_FUNCTION = YES; 287 | GCC_WARN_UNUSED_VARIABLE = YES; 288 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 289 | METAL_ENABLE_DEBUG_INFO = YES; 290 | ONLY_ACTIVE_ARCH = YES; 291 | SDKROOT = iphoneos; 292 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 293 | TARGETED_DEVICE_FAMILY = "1,2"; 294 | }; 295 | name = Debug; 296 | }; 297 | 048551351949570400E9591C /* Release */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ALWAYS_SEARCH_USER_PATHS = NO; 301 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 302 | CLANG_CXX_LIBRARY = "libc++"; 303 | CLANG_ENABLE_MODULES = YES; 304 | CLANG_ENABLE_OBJC_ARC = YES; 305 | CLANG_WARN_BOOL_CONVERSION = YES; 306 | CLANG_WARN_CONSTANT_CONVERSION = YES; 307 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 308 | CLANG_WARN_EMPTY_BODY = YES; 309 | CLANG_WARN_ENUM_CONVERSION = YES; 310 | CLANG_WARN_INT_CONVERSION = YES; 311 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 312 | CLANG_WARN_UNREACHABLE_CODE = YES; 313 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 314 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 315 | COPY_PHASE_STRIP = YES; 316 | ENABLE_NS_ASSERTIONS = NO; 317 | ENABLE_STRICT_OBJC_MSGSEND = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu99; 319 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 320 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 321 | GCC_WARN_UNDECLARED_SELECTOR = YES; 322 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 323 | GCC_WARN_UNUSED_FUNCTION = YES; 324 | GCC_WARN_UNUSED_VARIABLE = YES; 325 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 326 | METAL_ENABLE_DEBUG_INFO = NO; 327 | SDKROOT = iphoneos; 328 | TARGETED_DEVICE_FAMILY = "1,2"; 329 | VALIDATE_PRODUCT = YES; 330 | }; 331 | name = Release; 332 | }; 333 | 048551371949570400E9591C /* Debug */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 337 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 338 | INFOPLIST_FILE = PhysicsField/Info.plist; 339 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 340 | PRODUCT_NAME = "$(TARGET_NAME)"; 341 | }; 342 | name = Debug; 343 | }; 344 | 048551381949570400E9591C /* Release */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 348 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 349 | INFOPLIST_FILE = PhysicsField/Info.plist; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | }; 353 | name = Release; 354 | }; 355 | 0485513A1949570400E9591C /* Debug */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PhysicsField.app/PhysicsField"; 359 | FRAMEWORK_SEARCH_PATHS = ( 360 | "$(SDKROOT)/Developer/Library/Frameworks", 361 | "$(inherited)", 362 | ); 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | INFOPLIST_FILE = PhysicsFieldTests/Info.plist; 368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 369 | METAL_ENABLE_DEBUG_INFO = YES; 370 | PRODUCT_NAME = "$(TARGET_NAME)"; 371 | TEST_HOST = "$(BUNDLE_LOADER)"; 372 | }; 373 | name = Debug; 374 | }; 375 | 0485513B1949570400E9591C /* Release */ = { 376 | isa = XCBuildConfiguration; 377 | buildSettings = { 378 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/PhysicsField.app/PhysicsField"; 379 | FRAMEWORK_SEARCH_PATHS = ( 380 | "$(SDKROOT)/Developer/Library/Frameworks", 381 | "$(inherited)", 382 | ); 383 | INFOPLIST_FILE = PhysicsFieldTests/Info.plist; 384 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 385 | METAL_ENABLE_DEBUG_INFO = NO; 386 | PRODUCT_NAME = "$(TARGET_NAME)"; 387 | TEST_HOST = "$(BUNDLE_LOADER)"; 388 | }; 389 | name = Release; 390 | }; 391 | /* End XCBuildConfiguration section */ 392 | 393 | /* Begin XCConfigurationList section */ 394 | 048551111949570400E9591C /* Build configuration list for PBXProject "PhysicsField" */ = { 395 | isa = XCConfigurationList; 396 | buildConfigurations = ( 397 | 048551341949570400E9591C /* Debug */, 398 | 048551351949570400E9591C /* Release */, 399 | ); 400 | defaultConfigurationIsVisible = 0; 401 | defaultConfigurationName = Release; 402 | }; 403 | 048551361949570400E9591C /* Build configuration list for PBXNativeTarget "PhysicsField" */ = { 404 | isa = XCConfigurationList; 405 | buildConfigurations = ( 406 | 048551371949570400E9591C /* Debug */, 407 | 048551381949570400E9591C /* Release */, 408 | ); 409 | defaultConfigurationIsVisible = 0; 410 | }; 411 | 048551391949570400E9591C /* Build configuration list for PBXNativeTarget "PhysicsFieldTests" */ = { 412 | isa = XCConfigurationList; 413 | buildConfigurations = ( 414 | 0485513A1949570400E9591C /* Debug */, 415 | 0485513B1949570400E9591C /* Release */, 416 | ); 417 | defaultConfigurationIsVisible = 0; 418 | }; 419 | /* End XCConfigurationList section */ 420 | }; 421 | rootObject = 0485510E1949570400E9591C /* Project object */; 422 | } 423 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsField.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsField.xcodeproj/project.xcworkspace/xcshareddata/PhysicsField.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 71D3C370-36A8-49F1-B85A-AB025F1FF6E5 9 | IDESourceControlProjectName 10 | PhysicsField 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 14 | https://github.com/thibaultimbert/swift-experiments.git 15 | 16 | IDESourceControlProjectPath 17 | PhysicsField/PhysicsField.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/thibaultimbert/swift-experiments.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 36 | IDESourceControlWCCName 37 | swift-experiments 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsField.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/PhysicsField/PhysicsField.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /PhysicsField/PhysicsField.xcodeproj/xcuserdata/timbert.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsField.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/PhysicsField.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsField.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | PhysicsField.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 048551151949570400E9591C 16 | 17 | primary 18 | 19 | 20 | 0485512B1949570400E9591C 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // PhysicsField 4 | // 5 | // Created by Thibault Imbert on 2014-06-11. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/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 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/GameScene.sks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/PhysicsField/PhysicsField/GameScene.sks -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/GameScene.swift: -------------------------------------------------------------------------------- 1 | // Think as below as your Main class, basically the Stage 2 | // Note: The code below is for iOS, you can run it with the iOS simulator 3 | 4 | // this imports higher level APIs like Starling 5 | import SpriteKit 6 | 7 | // canvas size for the positioning 8 | let canvasWidth: UInt32 = 800 9 | let canvasHeight: UInt32 = 800 10 | 11 | // From the docs: 12 | // When a physics body is inside the region of a SKFieldNode object, that field node’s categoryBitMask property is 13 | // compared to this physics body’s fieldBitMask property by performing a logical AND operation. 14 | // If the result is a non-zero value, then the field node’s effect is applied to the physics body. 15 | let fieldMask : UInt32 = 0b1 16 | let categoryMask: UInt32 = 0b1 17 | 18 | // our main logic inside this class 19 | // we subclass the SKScene class by using the :TheType syntax below 20 | class GameScene: SKScene { 21 | 22 | // our field node member 23 | let fieldNode: SKFieldNode 24 | 25 | // the NSCoder abstract class declares the interface used by concrete subclasses (thanks 3r1d!) 26 | // see: http://stackoverflow.com/users/2664437/3r1d 27 | required init?(coder decoder: NSCoder){ 28 | // we create a magnetic field 29 | fieldNode = SKFieldNode.magneticField() 30 | // we define its body 31 | fieldNode.physicsBody = SKPhysicsBody(circleOfRadius: 80) 32 | // we add it to the display list (tree) 33 | fieldNode.categoryBitMask = categoryMask 34 | // strength of the field 35 | fieldNode.strength = 2.8 36 | // we initialize the superclass 37 | super.init(coder: decoder) 38 | } 39 | 40 | // this gets triggered automatically when presented to the view, put initialization logic here 41 | override func didMoveToView(view: SKView) { 42 | 43 | // we set the background color to black, self is the equivalent of this in Flash 44 | self.scene?.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 1) 45 | // we live in a world with gravity 46 | self.physicsWorld.gravity = CGVectorMake(0, -1) 47 | // we put contraints on the top, left, right, bottom so that our balls can bounce off them 48 | let physicsBody = SKPhysicsBody (edgeLoopFromRect: self.frame) 49 | // we set the body defining the physics to our scene 50 | self.physicsBody = physicsBody 51 | // we add it to the display list 52 | self.addChild(fieldNode) 53 | 54 | // let's create 300 bouncing cubes 55 | for i in 1...300 { 56 | 57 | // SkShapeNode is a primitive for drawing like with the AS3 Drawing API 58 | // it has built in support for primitives like a circle, or a rectangle, here we pass a rectangle 59 | let shape = SKShapeNode(rect: CGRectMake(-10, -10, 20, 20)) 60 | // we set the color and line style 61 | shape.strokeColor = UIColor(red: 255, green: 0, blue: 0, alpha: 1) 62 | // we set the stroke width 63 | shape.lineWidth = 4 64 | // we set initial random positions 65 | shape.position = CGPoint (x: CGFloat(arc4random()%(canvasWidth)), y: CGFloat(arc4random()%(canvasHeight))) 66 | // we add each circle to the display list 67 | self.addChild(shape) 68 | // we define the physics body 69 | shape.physicsBody = SKPhysicsBody(circleOfRadius: shape.frame.size.width/2) 70 | // from the docs: 71 | /*The force generated by this field is directed on line that is determined by calculating the cross-product 72 | between direction fo the the physics body’s velocity property and a line traced between the field node and the 73 | physics body. The force has a magnitude proportional to the field’s strength property and the physics body’s 74 | charge and velocity properties.*/ 75 | // we define a mass for the gravity 76 | shape.physicsBody?.mass = 0.9 77 | // the charge and field strength are two properties fun tweaking 78 | shape.physicsBody?.charge = 0.6 79 | // we set the field mask 80 | shape.physicsBody?.fieldBitMask = fieldMask 81 | // this will allow the balls to rotate when bouncing off each other 82 | shape.physicsBody?.allowsRotation = true 83 | } 84 | } 85 | 86 | // we capture the touch move events by overriding touchesMoved method 87 | override func touchesMoved(touches: (NSSet!), withEvent event: UIEvent) { 88 | // we grab the UITouch object in the current scene (self) coordinate 89 | let touch = event.allTouches()?.anyObject()?.locationInNode(self) 90 | // we apply the position of the touch to the physics field node 91 | self.fieldNode.position = touch! 92 | } 93 | 94 | // magic of the physics engine, we don't have to do anything here 95 | override func update(currentTime: CFTimeInterval) { 96 | } 97 | } -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/GameViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameViewController.swift 3 | // PhysicsField 4 | // 5 | // Created by Thibault Imbert on 2014-06-11. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SpriteKit 11 | 12 | extension SKNode { 13 | class func unarchiveFromFile(file : NSString) -> SKNode? { 14 | if let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks") { 15 | var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)! 16 | var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData) 17 | 18 | archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene") 19 | let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene 20 | archiver.finishDecoding() 21 | return scene 22 | } else { 23 | return nil 24 | } 25 | } 26 | } 27 | 28 | class GameViewController: UIViewController { 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | 33 | if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene { 34 | // Configure the view. 35 | let skView = self.view as SKView 36 | skView.showsFPS = true 37 | skView.showsNodeCount = true 38 | 39 | /* Sprite Kit applies additional optimizations to improve rendering performance */ 40 | skView.ignoresSiblingOrder = true 41 | 42 | /* Set the scale mode to scale to fit the window */ 43 | scene.scaleMode = .AspectFill 44 | 45 | skView.presentScene(scene) 46 | } 47 | } 48 | 49 | override func shouldAutorotate() -> Bool { 50 | return true 51 | } 52 | 53 | override func supportedInterfaceOrientations() -> Int { 54 | if UIDevice.currentDevice().userInterfaceIdiom == .Phone { 55 | return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue) 56 | } else { 57 | return Int(UIInterfaceOrientationMask.All.rawValue) 58 | } 59 | } 60 | 61 | override func didReceiveMemoryWarning() { 62 | super.didReceiveMemoryWarning() 63 | // Release any cached data, images, etc that aren't in use. 64 | } 65 | 66 | override func prefersStatusBarHidden() -> Bool { 67 | return true 68 | } 69 | } -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/Images.xcassets/Spaceship.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Spaceship.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/Images.xcassets/Spaceship.imageset/Spaceship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/PhysicsField/PhysicsField/Images.xcassets/Spaceship.imageset/Spaceship.png -------------------------------------------------------------------------------- /PhysicsField/PhysicsField/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsFieldTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /PhysicsField/PhysicsFieldTests/PhysicsFieldTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PhysicsFieldTests.swift 3 | // PhysicsFieldTests 4 | // 5 | // Created by Thibault Imbert on 2014-06-11. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class PhysicsFieldTests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | super.tearDown() 21 | } 22 | 23 | func testExample() { 24 | // This is an example of a functional test case. 25 | XCTAssert(true, "Pass") 26 | } 27 | 28 | func testPerformanceExample() { 29 | // This is an example of a performance test case. 30 | self.measureBlock() { 31 | // Put the code you want to measure the time of here. 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | swift-experiments 2 | ================= 3 | 4 | Fun with Swift from typedarray.org 5 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 049E78BE1972E8B600930228 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049E78BD1972E8B600930228 /* AppDelegate.swift */; }; 11 | 049E78C01972E8B700930228 /* GameScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 049E78BF1972E8B700930228 /* GameScene.sks */; }; 12 | 049E78C21972E8B700930228 /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049E78C11972E8B700930228 /* GameScene.swift */; }; 13 | 049E78C41972E8B700930228 /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049E78C31972E8B700930228 /* GameViewController.swift */; }; 14 | 049E78C71972E8B700930228 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 049E78C51972E8B700930228 /* Main.storyboard */; }; 15 | 049E78C91972E8B700930228 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 049E78C81972E8B700930228 /* Images.xcassets */; }; 16 | 049E78D51972E8B700930228 /* RemoteImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049E78D41972E8B700930228 /* RemoteImageTests.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 049E78CF1972E8B700930228 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 049E78B01972E8B600930228 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 049E78B71972E8B600930228; 25 | remoteInfo = RemoteImage; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 049E78B81972E8B600930228 /* RemoteImage.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RemoteImage.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 049E78BC1972E8B600930228 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 049E78BD1972E8B600930228 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | 049E78BF1972E8B700930228 /* GameScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = GameScene.sks; sourceTree = ""; }; 34 | 049E78C11972E8B700930228 /* GameScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = ""; }; 35 | 049E78C31972E8B700930228 /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = ""; }; 36 | 049E78C61972E8B700930228 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | 049E78C81972E8B700930228 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | 049E78CE1972E8B700930228 /* RemoteImageTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RemoteImageTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 049E78D31972E8B700930228 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 049E78D41972E8B700930228 /* RemoteImageTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteImageTests.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 049E78B51972E8B600930228 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | 049E78CB1972E8B700930228 /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 049E78AF1972E8B600930228 = { 62 | isa = PBXGroup; 63 | children = ( 64 | 049E78BA1972E8B600930228 /* RemoteImage */, 65 | 049E78D11972E8B700930228 /* RemoteImageTests */, 66 | 049E78B91972E8B600930228 /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 049E78B91972E8B600930228 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 049E78B81972E8B600930228 /* RemoteImage.app */, 74 | 049E78CE1972E8B700930228 /* RemoteImageTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 049E78BA1972E8B600930228 /* RemoteImage */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 049E78BD1972E8B600930228 /* AppDelegate.swift */, 83 | 049E78BF1972E8B700930228 /* GameScene.sks */, 84 | 049E78C11972E8B700930228 /* GameScene.swift */, 85 | 049E78C31972E8B700930228 /* GameViewController.swift */, 86 | 049E78C51972E8B700930228 /* Main.storyboard */, 87 | 049E78C81972E8B700930228 /* Images.xcassets */, 88 | 049E78BB1972E8B600930228 /* Supporting Files */, 89 | ); 90 | path = RemoteImage; 91 | sourceTree = ""; 92 | }; 93 | 049E78BB1972E8B600930228 /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 049E78BC1972E8B600930228 /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | 049E78D11972E8B700930228 /* RemoteImageTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 049E78D41972E8B700930228 /* RemoteImageTests.swift */, 105 | 049E78D21972E8B700930228 /* Supporting Files */, 106 | ); 107 | path = RemoteImageTests; 108 | sourceTree = ""; 109 | }; 110 | 049E78D21972E8B700930228 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 049E78D31972E8B700930228 /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | 049E78B71972E8B600930228 /* RemoteImage */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = 049E78D81972E8B700930228 /* Build configuration list for PBXNativeTarget "RemoteImage" */; 124 | buildPhases = ( 125 | 049E78B41972E8B600930228 /* Sources */, 126 | 049E78B51972E8B600930228 /* Frameworks */, 127 | 049E78B61972E8B600930228 /* Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = RemoteImage; 134 | productName = RemoteImage; 135 | productReference = 049E78B81972E8B600930228 /* RemoteImage.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | 049E78CD1972E8B700930228 /* RemoteImageTests */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 049E78DB1972E8B700930228 /* Build configuration list for PBXNativeTarget "RemoteImageTests" */; 141 | buildPhases = ( 142 | 049E78CA1972E8B700930228 /* Sources */, 143 | 049E78CB1972E8B700930228 /* Frameworks */, 144 | 049E78CC1972E8B700930228 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | 049E78D01972E8B700930228 /* PBXTargetDependency */, 150 | ); 151 | name = RemoteImageTests; 152 | productName = RemoteImageTests; 153 | productReference = 049E78CE1972E8B700930228 /* RemoteImageTests.xctest */; 154 | productType = "com.apple.product-type.bundle.unit-test"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | 049E78B01972E8B600930228 /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 0600; 163 | ORGANIZATIONNAME = "Thibault Imbert"; 164 | TargetAttributes = { 165 | 049E78B71972E8B600930228 = { 166 | CreatedOnToolsVersion = 6.0; 167 | }; 168 | 049E78CD1972E8B700930228 = { 169 | CreatedOnToolsVersion = 6.0; 170 | TestTargetID = 049E78B71972E8B600930228; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = 049E78B31972E8B600930228 /* Build configuration list for PBXProject "RemoteImage" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = 049E78AF1972E8B600930228; 183 | productRefGroup = 049E78B91972E8B600930228 /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | 049E78B71972E8B600930228 /* RemoteImage */, 188 | 049E78CD1972E8B700930228 /* RemoteImageTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | 049E78B61972E8B600930228 /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | 049E78C91972E8B700930228 /* Images.xcassets in Resources */, 199 | 049E78C01972E8B700930228 /* GameScene.sks in Resources */, 200 | 049E78C71972E8B700930228 /* Main.storyboard in Resources */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | 049E78CC1972E8B700930228 /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXResourcesBuildPhase section */ 212 | 213 | /* Begin PBXSourcesBuildPhase section */ 214 | 049E78B41972E8B600930228 /* Sources */ = { 215 | isa = PBXSourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 049E78C21972E8B700930228 /* GameScene.swift in Sources */, 219 | 049E78C41972E8B700930228 /* GameViewController.swift in Sources */, 220 | 049E78BE1972E8B600930228 /* AppDelegate.swift in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | 049E78CA1972E8B700930228 /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 049E78D51972E8B700930228 /* RemoteImageTests.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXTargetDependency section */ 235 | 049E78D01972E8B700930228 /* PBXTargetDependency */ = { 236 | isa = PBXTargetDependency; 237 | target = 049E78B71972E8B600930228 /* RemoteImage */; 238 | targetProxy = 049E78CF1972E8B700930228 /* PBXContainerItemProxy */; 239 | }; 240 | /* End PBXTargetDependency section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | 049E78C51972E8B700930228 /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 049E78C61972E8B700930228 /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 049E78D61972E8B700930228 /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ALWAYS_SEARCH_USER_PATHS = NO; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu99; 275 | GCC_DYNAMIC_NO_PIC = NO; 276 | GCC_OPTIMIZATION_LEVEL = 0; 277 | GCC_PREPROCESSOR_DEFINITIONS = ( 278 | "DEBUG=1", 279 | "$(inherited)", 280 | ); 281 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 284 | GCC_WARN_UNDECLARED_SELECTOR = YES; 285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 286 | GCC_WARN_UNUSED_FUNCTION = YES; 287 | GCC_WARN_UNUSED_VARIABLE = YES; 288 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 289 | MTL_ENABLE_DEBUG_INFO = YES; 290 | ONLY_ACTIVE_ARCH = YES; 291 | SDKROOT = iphoneos; 292 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 293 | TARGETED_DEVICE_FAMILY = "1,2"; 294 | }; 295 | name = Debug; 296 | }; 297 | 049E78D71972E8B700930228 /* Release */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ALWAYS_SEARCH_USER_PATHS = NO; 301 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 302 | CLANG_CXX_LIBRARY = "libc++"; 303 | CLANG_ENABLE_MODULES = YES; 304 | CLANG_ENABLE_OBJC_ARC = YES; 305 | CLANG_WARN_BOOL_CONVERSION = YES; 306 | CLANG_WARN_CONSTANT_CONVERSION = YES; 307 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 308 | CLANG_WARN_EMPTY_BODY = YES; 309 | CLANG_WARN_ENUM_CONVERSION = YES; 310 | CLANG_WARN_INT_CONVERSION = YES; 311 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 312 | CLANG_WARN_UNREACHABLE_CODE = YES; 313 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 314 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 315 | COPY_PHASE_STRIP = YES; 316 | ENABLE_NS_ASSERTIONS = NO; 317 | ENABLE_STRICT_OBJC_MSGSEND = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu99; 319 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 320 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 321 | GCC_WARN_UNDECLARED_SELECTOR = YES; 322 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 323 | GCC_WARN_UNUSED_FUNCTION = YES; 324 | GCC_WARN_UNUSED_VARIABLE = YES; 325 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 326 | MTL_ENABLE_DEBUG_INFO = NO; 327 | SDKROOT = iphoneos; 328 | TARGETED_DEVICE_FAMILY = "1,2"; 329 | VALIDATE_PRODUCT = YES; 330 | }; 331 | name = Release; 332 | }; 333 | 049E78D91972E8B700930228 /* Debug */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 337 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 338 | INFOPLIST_FILE = RemoteImage/Info.plist; 339 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 340 | PRODUCT_NAME = "$(TARGET_NAME)"; 341 | }; 342 | name = Debug; 343 | }; 344 | 049E78DA1972E8B700930228 /* Release */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 348 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 349 | INFOPLIST_FILE = RemoteImage/Info.plist; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | }; 353 | name = Release; 354 | }; 355 | 049E78DC1972E8B700930228 /* Debug */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RemoteImage.app/RemoteImage"; 359 | FRAMEWORK_SEARCH_PATHS = ( 360 | "$(SDKROOT)/Developer/Library/Frameworks", 361 | "$(inherited)", 362 | ); 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | INFOPLIST_FILE = RemoteImageTests/Info.plist; 368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | TEST_HOST = "$(BUNDLE_LOADER)"; 371 | }; 372 | name = Debug; 373 | }; 374 | 049E78DD1972E8B700930228 /* Release */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RemoteImage.app/RemoteImage"; 378 | FRAMEWORK_SEARCH_PATHS = ( 379 | "$(SDKROOT)/Developer/Library/Frameworks", 380 | "$(inherited)", 381 | ); 382 | INFOPLIST_FILE = RemoteImageTests/Info.plist; 383 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | TEST_HOST = "$(BUNDLE_LOADER)"; 386 | }; 387 | name = Release; 388 | }; 389 | /* End XCBuildConfiguration section */ 390 | 391 | /* Begin XCConfigurationList section */ 392 | 049E78B31972E8B600930228 /* Build configuration list for PBXProject "RemoteImage" */ = { 393 | isa = XCConfigurationList; 394 | buildConfigurations = ( 395 | 049E78D61972E8B700930228 /* Debug */, 396 | 049E78D71972E8B700930228 /* Release */, 397 | ); 398 | defaultConfigurationIsVisible = 0; 399 | defaultConfigurationName = Release; 400 | }; 401 | 049E78D81972E8B700930228 /* Build configuration list for PBXNativeTarget "RemoteImage" */ = { 402 | isa = XCConfigurationList; 403 | buildConfigurations = ( 404 | 049E78D91972E8B700930228 /* Debug */, 405 | 049E78DA1972E8B700930228 /* Release */, 406 | ); 407 | defaultConfigurationIsVisible = 0; 408 | }; 409 | 049E78DB1972E8B700930228 /* Build configuration list for PBXNativeTarget "RemoteImageTests" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | 049E78DC1972E8B700930228 /* Debug */, 413 | 049E78DD1972E8B700930228 /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | }; 417 | /* End XCConfigurationList section */ 418 | }; 419 | rootObject = 049E78B01972E8B600930228 /* Project object */; 420 | } 421 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage.xcodeproj/project.xcworkspace/xcshareddata/RemoteImage.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | B3EB60E9-6068-475B-90B7-C72648A54F03 9 | IDESourceControlProjectName 10 | RemoteImage 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 14 | https://github.com/thibaultimbert/swift-experiments.git 15 | 16 | IDESourceControlProjectPath 17 | RemoteImage/RemoteImage.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/thibaultimbert/swift-experiments.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 36 | IDESourceControlWCCName 37 | swift-experiments 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/RemoteImage/RemoteImage.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RemoteImage/RemoteImage.xcodeproj/xcuserdata/timbert.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/RemoteImage.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RemoteImage.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 049E78B71972E8B600930228 16 | 17 | primary 18 | 19 | 20 | 049E78CD1972E8B700930228 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // RemoteImage 4 | // 5 | // Created by Thibault Imbert on 2014-07-13. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication!) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication!) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication!) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication!) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication!) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/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 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/GameScene.sks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/RemoteImage/RemoteImage/GameScene.sks -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/GameScene.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameScene.swift 3 | // RemoteImage 4 | // 5 | // Created by Thibault Imbert on 2014-07-13. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import SpriteKit 10 | 11 | class GameScene: SKScene { 12 | 13 | // our properties 14 | var bytes: NSMutableData? 15 | var totalBytes: Float64? 16 | let label: SKLabelNode = SKLabelNode(fontNamed: "Verdana") 17 | 18 | override func didMoveToView(view: SKView) { 19 | // we create our text label for the preloading infos 20 | label.position = CGPoint (x: 520, y: 380) 21 | addChild (label) 22 | 23 | // this is our remote end point (similar to URLRequest in AS3) 24 | let request = NSURLRequest(URL: NSURL(string: "https://s3.amazonaws.com/ooomf-com-files/yvDPJ8ZSmSVob7pRxIvU_IMG_40322.jpg")!) 25 | 26 | // this is what creates the connection and dispatches the varios events to track progression, etc. 27 | let loader = NSURLConnection(request: request, delegate: self, startImmediately: true) 28 | } 29 | 30 | func connection(connection: NSURLConnection!, didReceiveResponse response: NSURLResponse!) { 31 | // we initialize our buffer 32 | self.bytes = NSMutableData() 33 | 34 | // we grab the total bytes expected to load 35 | totalBytes = Float64(response.expectedContentLength) 36 | } 37 | 38 | func connection(connection: NSURLConnection!, didReceiveData conData: NSData!) { 39 | // we append the bytes as they come in 40 | self.bytes!.appendData(conData) 41 | 42 | // we calculate our ratio 43 | // we divide the loaded bytes with the total bytes to get the ratio, we mulitply by 100 44 | // note that we floor the value 45 | var ratio = floor((Float64(self.bytes!.length) / totalBytes!) * 100) 46 | 47 | // we cast to Int to remove the decimal and concatenate with % 48 | self.label.text = String (Int(ratio)) + " %" 49 | } 50 | 51 | func connectionDidFinishLoading(connection: NSURLConnection!) { 52 | // we create a UIImage out of the completed bytes we loaded 53 | let imageBytes = UIImage(data: self.bytes!) 54 | 55 | // we create a texture 56 | let texture = SKTexture(image: imageBytes!) 57 | 58 | // then a sprite 59 | let sprite = SKSpriteNode(texture: texture) 60 | 61 | if let bounds = self.view?.bounds { 62 | 63 | // we calculate the ratio so that our image can fit in the canvas size and be scaled appropriately 64 | var scalingRatio = min (bounds.width/sprite.size.width, bounds.height/sprite.size.height) 65 | 66 | // we apply the scaling 67 | sprite.xScale = scalingRatio 68 | sprite.yScale = scalingRatio 69 | 70 | // we position our image 71 | sprite.position = CGPoint (x: 510, y: 380) 72 | 73 | // we remove the percentage label 74 | label.removeFromParent() 75 | 76 | // we add our final image to the display list 77 | addChild(sprite) 78 | } 79 | } 80 | 81 | override func update(currentTime: CFTimeInterval) { 82 | /* Called before each frame is rendered */ 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/GameViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameViewController.swift 3 | // RemoteImage 4 | // 5 | // Created by Thibault Imbert on 2014-07-13. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SpriteKit 11 | 12 | extension SKNode { 13 | class func unarchiveFromFile(file : NSString) -> SKNode? { 14 | if let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks") { 15 | var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)! 16 | var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData) 17 | 18 | archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene") 19 | let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene 20 | archiver.finishDecoding() 21 | return scene 22 | } else { 23 | return nil 24 | } 25 | } 26 | } 27 | 28 | class GameViewController: UIViewController { 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | 33 | if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene { 34 | // Configure the view. 35 | let skView = self.view as SKView 36 | skView.showsFPS = true 37 | skView.showsNodeCount = true 38 | 39 | /* Sprite Kit applies additional optimizations to improve rendering performance */ 40 | skView.ignoresSiblingOrder = true 41 | 42 | /* Set the scale mode to scale to fit the window */ 43 | scene.scaleMode = .AspectFill 44 | 45 | skView.presentScene(scene) 46 | } 47 | } 48 | 49 | override func shouldAutorotate() -> Bool { 50 | return true 51 | } 52 | 53 | override func supportedInterfaceOrientations() -> Int { 54 | if UIDevice.currentDevice().userInterfaceIdiom == .Phone { 55 | return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue) 56 | } else { 57 | return Int(UIInterfaceOrientationMask.All.rawValue) 58 | } 59 | } 60 | 61 | override func didReceiveMemoryWarning() { 62 | super.didReceiveMemoryWarning() 63 | // Release any cached data, images, etc that aren't in use. 64 | } 65 | 66 | override func prefersStatusBarHidden() -> Bool { 67 | return true 68 | } 69 | } -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/Images.xcassets/Spaceship.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Spaceship.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/Images.xcassets/Spaceship.imageset/Spaceship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/RemoteImage/RemoteImage/Images.xcassets/Spaceship.imageset/Spaceship.png -------------------------------------------------------------------------------- /RemoteImage/RemoteImage/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImageTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RemoteImage/RemoteImageTests/RemoteImageTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RemoteImageTests.swift 3 | // RemoteImageTests 4 | // 5 | // Created by Thibault Imbert on 2014-07-13. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class RemoteImageTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 04EA5E57197150AB00F4DB50 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA5E56197150AB00F4DB50 /* AppDelegate.swift */; }; 11 | 04EA5E59197150AB00F4DB50 /* GameScene.sks in Resources */ = {isa = PBXBuildFile; fileRef = 04EA5E58197150AB00F4DB50 /* GameScene.sks */; }; 12 | 04EA5E5B197150AB00F4DB50 /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA5E5A197150AB00F4DB50 /* GameScene.swift */; }; 13 | 04EA5E5D197150AB00F4DB50 /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA5E5C197150AB00F4DB50 /* GameViewController.swift */; }; 14 | 04EA5E60197150AB00F4DB50 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 04EA5E5E197150AB00F4DB50 /* Main.storyboard */; }; 15 | 04EA5E62197150AB00F4DB50 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 04EA5E61197150AB00F4DB50 /* Images.xcassets */; }; 16 | 04EA5E6E197150AB00F4DB50 /* RemoteJSONTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA5E6D197150AB00F4DB50 /* RemoteJSONTests.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 04EA5E68197150AB00F4DB50 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = 04EA5E49197150AB00F4DB50 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = 04EA5E50197150AB00F4DB50; 25 | remoteInfo = RemoteJSON; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 04EA5E51197150AB00F4DB50 /* RemoteJSON.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RemoteJSON.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 04EA5E55197150AB00F4DB50 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | 04EA5E56197150AB00F4DB50 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | 04EA5E58197150AB00F4DB50 /* GameScene.sks */ = {isa = PBXFileReference; lastKnownFileType = file.sks; path = GameScene.sks; sourceTree = ""; }; 34 | 04EA5E5A197150AB00F4DB50 /* GameScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameScene.swift; sourceTree = ""; }; 35 | 04EA5E5C197150AB00F4DB50 /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = ""; }; 36 | 04EA5E5F197150AB00F4DB50 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | 04EA5E61197150AB00F4DB50 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | 04EA5E67197150AB00F4DB50 /* RemoteJSONTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RemoteJSONTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 04EA5E6C197150AB00F4DB50 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 40 | 04EA5E6D197150AB00F4DB50 /* RemoteJSONTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RemoteJSONTests.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 04EA5E4E197150AB00F4DB50 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | 04EA5E64197150AB00F4DB50 /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | 04EA5E48197150AB00F4DB50 = { 62 | isa = PBXGroup; 63 | children = ( 64 | 04EA5E53197150AB00F4DB50 /* RemoteJSON */, 65 | 04EA5E6A197150AB00F4DB50 /* RemoteJSONTests */, 66 | 04EA5E52197150AB00F4DB50 /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | 04EA5E52197150AB00F4DB50 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 04EA5E51197150AB00F4DB50 /* RemoteJSON.app */, 74 | 04EA5E67197150AB00F4DB50 /* RemoteJSONTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | 04EA5E53197150AB00F4DB50 /* RemoteJSON */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 04EA5E56197150AB00F4DB50 /* AppDelegate.swift */, 83 | 04EA5E58197150AB00F4DB50 /* GameScene.sks */, 84 | 04EA5E5A197150AB00F4DB50 /* GameScene.swift */, 85 | 04EA5E5C197150AB00F4DB50 /* GameViewController.swift */, 86 | 04EA5E5E197150AB00F4DB50 /* Main.storyboard */, 87 | 04EA5E61197150AB00F4DB50 /* Images.xcassets */, 88 | 04EA5E54197150AB00F4DB50 /* Supporting Files */, 89 | ); 90 | path = RemoteJSON; 91 | sourceTree = ""; 92 | }; 93 | 04EA5E54197150AB00F4DB50 /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 04EA5E55197150AB00F4DB50 /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | 04EA5E6A197150AB00F4DB50 /* RemoteJSONTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 04EA5E6D197150AB00F4DB50 /* RemoteJSONTests.swift */, 105 | 04EA5E6B197150AB00F4DB50 /* Supporting Files */, 106 | ); 107 | path = RemoteJSONTests; 108 | sourceTree = ""; 109 | }; 110 | 04EA5E6B197150AB00F4DB50 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 04EA5E6C197150AB00F4DB50 /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | 04EA5E50197150AB00F4DB50 /* RemoteJSON */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = 04EA5E71197150AB00F4DB50 /* Build configuration list for PBXNativeTarget "RemoteJSON" */; 124 | buildPhases = ( 125 | 04EA5E4D197150AB00F4DB50 /* Sources */, 126 | 04EA5E4E197150AB00F4DB50 /* Frameworks */, 127 | 04EA5E4F197150AB00F4DB50 /* Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = RemoteJSON; 134 | productName = RemoteJSON; 135 | productReference = 04EA5E51197150AB00F4DB50 /* RemoteJSON.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | 04EA5E66197150AB00F4DB50 /* RemoteJSONTests */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = 04EA5E74197150AB00F4DB50 /* Build configuration list for PBXNativeTarget "RemoteJSONTests" */; 141 | buildPhases = ( 142 | 04EA5E63197150AB00F4DB50 /* Sources */, 143 | 04EA5E64197150AB00F4DB50 /* Frameworks */, 144 | 04EA5E65197150AB00F4DB50 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | 04EA5E69197150AB00F4DB50 /* PBXTargetDependency */, 150 | ); 151 | name = RemoteJSONTests; 152 | productName = RemoteJSONTests; 153 | productReference = 04EA5E67197150AB00F4DB50 /* RemoteJSONTests.xctest */; 154 | productType = "com.apple.product-type.bundle.unit-test"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | 04EA5E49197150AB00F4DB50 /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 0600; 163 | ORGANIZATIONNAME = "Thibault Imbert"; 164 | TargetAttributes = { 165 | 04EA5E50197150AB00F4DB50 = { 166 | CreatedOnToolsVersion = 6.0; 167 | }; 168 | 04EA5E66197150AB00F4DB50 = { 169 | CreatedOnToolsVersion = 6.0; 170 | TestTargetID = 04EA5E50197150AB00F4DB50; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = 04EA5E4C197150AB00F4DB50 /* Build configuration list for PBXProject "RemoteJSON" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = 04EA5E48197150AB00F4DB50; 183 | productRefGroup = 04EA5E52197150AB00F4DB50 /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | 04EA5E50197150AB00F4DB50 /* RemoteJSON */, 188 | 04EA5E66197150AB00F4DB50 /* RemoteJSONTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | 04EA5E4F197150AB00F4DB50 /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | 04EA5E62197150AB00F4DB50 /* Images.xcassets in Resources */, 199 | 04EA5E59197150AB00F4DB50 /* GameScene.sks in Resources */, 200 | 04EA5E60197150AB00F4DB50 /* Main.storyboard in Resources */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | 04EA5E65197150AB00F4DB50 /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXResourcesBuildPhase section */ 212 | 213 | /* Begin PBXSourcesBuildPhase section */ 214 | 04EA5E4D197150AB00F4DB50 /* Sources */ = { 215 | isa = PBXSourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | 04EA5E5B197150AB00F4DB50 /* GameScene.swift in Sources */, 219 | 04EA5E5D197150AB00F4DB50 /* GameViewController.swift in Sources */, 220 | 04EA5E57197150AB00F4DB50 /* AppDelegate.swift in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | 04EA5E63197150AB00F4DB50 /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | 04EA5E6E197150AB00F4DB50 /* RemoteJSONTests.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXTargetDependency section */ 235 | 04EA5E69197150AB00F4DB50 /* PBXTargetDependency */ = { 236 | isa = PBXTargetDependency; 237 | target = 04EA5E50197150AB00F4DB50 /* RemoteJSON */; 238 | targetProxy = 04EA5E68197150AB00F4DB50 /* PBXContainerItemProxy */; 239 | }; 240 | /* End PBXTargetDependency section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | 04EA5E5E197150AB00F4DB50 /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 04EA5E5F197150AB00F4DB50 /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | /* End PBXVariantGroup section */ 252 | 253 | /* Begin XCBuildConfiguration section */ 254 | 04EA5E6F197150AB00F4DB50 /* Debug */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | ALWAYS_SEARCH_USER_PATHS = NO; 258 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 259 | CLANG_CXX_LIBRARY = "libc++"; 260 | CLANG_ENABLE_MODULES = YES; 261 | CLANG_ENABLE_OBJC_ARC = YES; 262 | CLANG_WARN_BOOL_CONVERSION = YES; 263 | CLANG_WARN_CONSTANT_CONVERSION = YES; 264 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INT_CONVERSION = YES; 268 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 269 | CLANG_WARN_UNREACHABLE_CODE = YES; 270 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 271 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 272 | COPY_PHASE_STRIP = NO; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu99; 275 | GCC_DYNAMIC_NO_PIC = NO; 276 | GCC_OPTIMIZATION_LEVEL = 0; 277 | GCC_PREPROCESSOR_DEFINITIONS = ( 278 | "DEBUG=1", 279 | "$(inherited)", 280 | ); 281 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 282 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 283 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 284 | GCC_WARN_UNDECLARED_SELECTOR = YES; 285 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 286 | GCC_WARN_UNUSED_FUNCTION = YES; 287 | GCC_WARN_UNUSED_VARIABLE = YES; 288 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 289 | MTL_ENABLE_DEBUG_INFO = YES; 290 | ONLY_ACTIVE_ARCH = YES; 291 | SDKROOT = iphoneos; 292 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 293 | TARGETED_DEVICE_FAMILY = "1,2"; 294 | }; 295 | name = Debug; 296 | }; 297 | 04EA5E70197150AB00F4DB50 /* Release */ = { 298 | isa = XCBuildConfiguration; 299 | buildSettings = { 300 | ALWAYS_SEARCH_USER_PATHS = NO; 301 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 302 | CLANG_CXX_LIBRARY = "libc++"; 303 | CLANG_ENABLE_MODULES = YES; 304 | CLANG_ENABLE_OBJC_ARC = YES; 305 | CLANG_WARN_BOOL_CONVERSION = YES; 306 | CLANG_WARN_CONSTANT_CONVERSION = YES; 307 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 308 | CLANG_WARN_EMPTY_BODY = YES; 309 | CLANG_WARN_ENUM_CONVERSION = YES; 310 | CLANG_WARN_INT_CONVERSION = YES; 311 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 312 | CLANG_WARN_UNREACHABLE_CODE = YES; 313 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 314 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 315 | COPY_PHASE_STRIP = YES; 316 | ENABLE_NS_ASSERTIONS = NO; 317 | ENABLE_STRICT_OBJC_MSGSEND = YES; 318 | GCC_C_LANGUAGE_STANDARD = gnu99; 319 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 320 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 321 | GCC_WARN_UNDECLARED_SELECTOR = YES; 322 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 323 | GCC_WARN_UNUSED_FUNCTION = YES; 324 | GCC_WARN_UNUSED_VARIABLE = YES; 325 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 326 | MTL_ENABLE_DEBUG_INFO = NO; 327 | SDKROOT = iphoneos; 328 | TARGETED_DEVICE_FAMILY = "1,2"; 329 | VALIDATE_PRODUCT = YES; 330 | }; 331 | name = Release; 332 | }; 333 | 04EA5E72197150AB00F4DB50 /* Debug */ = { 334 | isa = XCBuildConfiguration; 335 | buildSettings = { 336 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 337 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 338 | INFOPLIST_FILE = RemoteJSON/Info.plist; 339 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 340 | PRODUCT_NAME = "$(TARGET_NAME)"; 341 | }; 342 | name = Debug; 343 | }; 344 | 04EA5E73197150AB00F4DB50 /* Release */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 348 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 349 | INFOPLIST_FILE = RemoteJSON/Info.plist; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 351 | PRODUCT_NAME = "$(TARGET_NAME)"; 352 | }; 353 | name = Release; 354 | }; 355 | 04EA5E75197150AB00F4DB50 /* Debug */ = { 356 | isa = XCBuildConfiguration; 357 | buildSettings = { 358 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RemoteJSON.app/RemoteJSON"; 359 | FRAMEWORK_SEARCH_PATHS = ( 360 | "$(SDKROOT)/Developer/Library/Frameworks", 361 | "$(inherited)", 362 | ); 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | INFOPLIST_FILE = RemoteJSONTests/Info.plist; 368 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 369 | PRODUCT_NAME = "$(TARGET_NAME)"; 370 | TEST_HOST = "$(BUNDLE_LOADER)"; 371 | }; 372 | name = Debug; 373 | }; 374 | 04EA5E76197150AB00F4DB50 /* Release */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/RemoteJSON.app/RemoteJSON"; 378 | FRAMEWORK_SEARCH_PATHS = ( 379 | "$(SDKROOT)/Developer/Library/Frameworks", 380 | "$(inherited)", 381 | ); 382 | INFOPLIST_FILE = RemoteJSONTests/Info.plist; 383 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | TEST_HOST = "$(BUNDLE_LOADER)"; 386 | }; 387 | name = Release; 388 | }; 389 | /* End XCBuildConfiguration section */ 390 | 391 | /* Begin XCConfigurationList section */ 392 | 04EA5E4C197150AB00F4DB50 /* Build configuration list for PBXProject "RemoteJSON" */ = { 393 | isa = XCConfigurationList; 394 | buildConfigurations = ( 395 | 04EA5E6F197150AB00F4DB50 /* Debug */, 396 | 04EA5E70197150AB00F4DB50 /* Release */, 397 | ); 398 | defaultConfigurationIsVisible = 0; 399 | defaultConfigurationName = Release; 400 | }; 401 | 04EA5E71197150AB00F4DB50 /* Build configuration list for PBXNativeTarget "RemoteJSON" */ = { 402 | isa = XCConfigurationList; 403 | buildConfigurations = ( 404 | 04EA5E72197150AB00F4DB50 /* Debug */, 405 | 04EA5E73197150AB00F4DB50 /* Release */, 406 | ); 407 | defaultConfigurationIsVisible = 0; 408 | }; 409 | 04EA5E74197150AB00F4DB50 /* Build configuration list for PBXNativeTarget "RemoteJSONTests" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | 04EA5E75197150AB00F4DB50 /* Debug */, 413 | 04EA5E76197150AB00F4DB50 /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | }; 417 | /* End XCConfigurationList section */ 418 | }; 419 | rootObject = 04EA5E49197150AB00F4DB50 /* Project object */; 420 | } 421 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON.xcodeproj/project.xcworkspace/xcshareddata/RemoteJSON.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | FBF8D99E-3835-4C0A-9A9C-E5CAC3AFEDDB 9 | IDESourceControlProjectName 10 | RemoteJSON 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 14 | https://github.com/thibaultimbert/swift-experiments.git 15 | 16 | IDESourceControlProjectPath 17 | RemoteJSON/RemoteJSON.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/thibaultimbert/swift-experiments.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | DF711FF9285B2F519689CB1B321D13B701C4BFC2 36 | IDESourceControlWCCName 37 | swift-experiments 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/RemoteJSON/RemoteJSON.xcodeproj/project.xcworkspace/xcuserdata/timbert.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON.xcodeproj/xcuserdata/timbert.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/RemoteJSON.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON.xcodeproj/xcuserdata/timbert.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RemoteJSON.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 04EA5E50197150AB00F4DB50 16 | 17 | primary 18 | 19 | 20 | 04EA5E66197150AB00F4DB50 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // RemoteJSON 4 | // 5 | // Created by Thibault Imbert on 2014-07-12. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication!) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication!) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication!) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication!) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication!) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/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 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/GameScene.sks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/RemoteJSON/RemoteJSON/GameScene.sks -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/GameScene.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameScene.swift 3 | // RemoteJSON 4 | // 5 | // Created by Thibault Imbert on 2014-07-12. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import SpriteKit 10 | 11 | class GameScene: SKScene { 12 | 13 | var bytes: NSMutableData? 14 | 15 | override func didMoveToView(view: SKView) { 16 | // this is our remote end point (similar to URLRequest in AS3) 17 | let request = NSURLRequest(URL: NSURL(string: "http://bytearray.org/wp-content/projects/json/colors.json")!) 18 | 19 | // this is what creates the connection and dispatches the varios events to track progression, etc. 20 | let loader = NSURLConnection(request: request, delegate: self, startImmediately: true) 21 | } 22 | 23 | func connection(connection: NSURLConnection!, didReceiveResponse response: NSURLResponse!) { 24 | // we initialize our buffer 25 | self.bytes = NSMutableData() 26 | } 27 | 28 | func connection(connection: NSURLConnection!, didReceiveData conData: NSData!) { 29 | // we append the bytes as they come in 30 | self.bytes?.appendData(conData) 31 | } 32 | 33 | func connectionDidFinishLoading(connection: NSURLConnection!) { 34 | 35 | // we serialize our bytes back to the original JSON structure 36 | let jsonResult: Dictionary = NSJSONSerialization.JSONObjectWithData(self.bytes!, options: NSJSONReadingOptions.MutableContainers, error: nil) as Dictionary 37 | 38 | // we grab the colorsArray element 39 | let results: NSArray = jsonResult["colorsArray"] as NSArray 40 | 41 | // we iterate over each element of the colorsArray array 42 | for item in results { 43 | // we convert each key to a String 44 | var name: String = item["colorName"] as String 45 | var color: String = item["hexValue"] as String 46 | println("\(name): \(color)") 47 | } 48 | } 49 | 50 | override func update(currentTime: CFTimeInterval) { 51 | /* Called before each frame is rendered */ 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/GameViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // GameViewController.swift 3 | // RemoteJSON 4 | // 5 | // Created by Thibault Imbert on 2014-07-12. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import SpriteKit 11 | 12 | extension SKNode { 13 | class func unarchiveFromFile(file : NSString) -> SKNode? { 14 | if let path = NSBundle.mainBundle().pathForResource(file, ofType: "sks") { 15 | var sceneData = NSData(contentsOfFile: path, options: .DataReadingMappedIfSafe, error: nil)! 16 | var archiver = NSKeyedUnarchiver(forReadingWithData: sceneData) 17 | 18 | archiver.setClass(self.classForKeyedUnarchiver(), forClassName: "SKScene") 19 | let scene = archiver.decodeObjectForKey(NSKeyedArchiveRootObjectKey) as GameScene 20 | archiver.finishDecoding() 21 | return scene 22 | } else { 23 | return nil 24 | } 25 | } 26 | } 27 | 28 | class GameViewController: UIViewController { 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | 33 | if let scene = GameScene.unarchiveFromFile("GameScene") as? GameScene { 34 | // Configure the view. 35 | let skView = self.view as SKView 36 | skView.showsFPS = true 37 | skView.showsNodeCount = true 38 | 39 | /* Sprite Kit applies additional optimizations to improve rendering performance */ 40 | skView.ignoresSiblingOrder = true 41 | 42 | /* Set the scale mode to scale to fit the window */ 43 | scene.scaleMode = .AspectFill 44 | 45 | skView.presentScene(scene) 46 | } 47 | } 48 | 49 | override func shouldAutorotate() -> Bool { 50 | return true 51 | } 52 | 53 | override func supportedInterfaceOrientations() -> Int { 54 | if UIDevice.currentDevice().userInterfaceIdiom == .Phone { 55 | return Int(UIInterfaceOrientationMask.AllButUpsideDown.rawValue) 56 | } else { 57 | return Int(UIInterfaceOrientationMask.All.rawValue) 58 | } 59 | } 60 | 61 | override func didReceiveMemoryWarning() { 62 | super.didReceiveMemoryWarning() 63 | // Release any cached data, images, etc that aren't in use. 64 | } 65 | 66 | override func prefersStatusBarHidden() -> Bool { 67 | return true 68 | } 69 | } -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/Images.xcassets/Spaceship.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x", 6 | "filename" : "Spaceship.png" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/Images.xcassets/Spaceship.imageset/Spaceship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thibaultimbert/swift-experiments/8b95d08a7aadf233dcb6ed866a5335eab9588fab/RemoteJSON/RemoteJSON/Images.xcassets/Spaceship.imageset/Spaceship.png -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSON/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UIStatusBarHidden 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSONTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | test.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /RemoteJSON/RemoteJSONTests/RemoteJSONTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // RemoteJSONTests.swift 3 | // RemoteJSONTests 4 | // 5 | // Created by Thibault Imbert on 2014-07-12. 6 | // Copyright (c) 2014 Thibault Imbert. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class RemoteJSONTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------