├── README.md ├── SwiftSummit.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── jriehn.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── jriehn.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── SwiftSummit.xcscheme │ └── xcschememanagement.plist ├── SwiftSummit ├── Account.swift ├── AnimationWithClosures.swift ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── DetailViewController.swift ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── MailService.swift ├── MasterViewController.swift ├── Message.swift ├── OrderService.swift └── SwiftSummit.xcdatamodeld │ ├── .xccurrentversion │ └── SwiftSummit.xcdatamodel │ └── contents └── SwiftSummitTests ├── AsyncTests.swift ├── FakeTests.swift ├── Info.plist ├── MockTests.swift ├── ReflectionTests.swift └── StubTests.swift /README.md: -------------------------------------------------------------------------------- 1 | # testing-in-swift 2 | -------------------------------------------------------------------------------- /SwiftSummit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 631ABEC61ABCA17A0070E2D9 /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63215BF21AB863B20040593C /* DetailViewController.swift */; }; 11 | 631ABEC71ABCA7B60070E2D9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63215BEB1AB863B20040593C /* AppDelegate.swift */; }; 12 | 631ABECC1ABDB51C0070E2D9 /* MailService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABECB1ABDB51C0070E2D9 /* MailService.swift */; }; 13 | 631ABECE1ABDB5370070E2D9 /* MockTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABECD1ABDB5370070E2D9 /* MockTests.swift */; }; 14 | 631ABED01ABDB5410070E2D9 /* FakeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABECF1ABDB5410070E2D9 /* FakeTests.swift */; }; 15 | 631ABED21ABDB54E0070E2D9 /* StubTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABED11ABDB54E0070E2D9 /* StubTests.swift */; }; 16 | 631ABED61ABDB7470070E2D9 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABED51ABDB7470070E2D9 /* Account.swift */; }; 17 | 631ABED81ABDB7D60070E2D9 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABED71ABDB7D60070E2D9 /* Message.swift */; }; 18 | 631ABEDA1ABDB8130070E2D9 /* OrderService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABED91ABDB8130070E2D9 /* OrderService.swift */; }; 19 | 631ABEDC1ABDB8900070E2D9 /* AsyncTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABEDB1ABDB8900070E2D9 /* AsyncTests.swift */; }; 20 | 631ABEDE1ABDCA040070E2D9 /* ReflectionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABEDD1ABDCA040070E2D9 /* ReflectionTests.swift */; }; 21 | 631ABEE01ABDCA980070E2D9 /* AnimationWithClosures.swift in Sources */ = {isa = PBXBuildFile; fileRef = 631ABEDF1ABDCA980070E2D9 /* AnimationWithClosures.swift */; }; 22 | 63215BEC1AB863B20040593C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63215BEB1AB863B20040593C /* AppDelegate.swift */; }; 23 | 63215BEF1AB863B20040593C /* SwiftSummit.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 63215BED1AB863B20040593C /* SwiftSummit.xcdatamodeld */; }; 24 | 63215BF11AB863B20040593C /* MasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63215BF01AB863B20040593C /* MasterViewController.swift */; }; 25 | 63215BF31AB863B20040593C /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 63215BF21AB863B20040593C /* DetailViewController.swift */; }; 26 | 63215BF61AB863B20040593C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 63215BF41AB863B20040593C /* Main.storyboard */; }; 27 | 63215BF81AB863B20040593C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 63215BF71AB863B20040593C /* Images.xcassets */; }; 28 | 63215BFB1AB863B20040593C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 63215BF91AB863B20040593C /* LaunchScreen.xib */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | 63215C011AB863B20040593C /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 63215BDE1AB863B20040593C /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 63215BE51AB863B20040593C; 37 | remoteInfo = SwiftSummit; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 631ABECB1ABDB51C0070E2D9 /* MailService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MailService.swift; sourceTree = ""; }; 43 | 631ABECD1ABDB5370070E2D9 /* MockTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MockTests.swift; sourceTree = ""; }; 44 | 631ABECF1ABDB5410070E2D9 /* FakeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FakeTests.swift; sourceTree = ""; }; 45 | 631ABED11ABDB54E0070E2D9 /* StubTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StubTests.swift; sourceTree = ""; }; 46 | 631ABED51ABDB7470070E2D9 /* Account.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Account.swift; sourceTree = ""; }; 47 | 631ABED71ABDB7D60070E2D9 /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = ""; }; 48 | 631ABED91ABDB8130070E2D9 /* OrderService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderService.swift; sourceTree = ""; }; 49 | 631ABEDB1ABDB8900070E2D9 /* AsyncTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncTests.swift; sourceTree = ""; }; 50 | 631ABEDD1ABDCA040070E2D9 /* ReflectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReflectionTests.swift; sourceTree = ""; }; 51 | 631ABEDF1ABDCA980070E2D9 /* AnimationWithClosures.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnimationWithClosures.swift; sourceTree = ""; }; 52 | 63215BE61AB863B20040593C /* SwiftSummit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftSummit.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 63215BEA1AB863B20040593C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | 63215BEB1AB863B20040593C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 55 | 63215BEE1AB863B20040593C /* SwiftSummit.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = SwiftSummit.xcdatamodel; sourceTree = ""; }; 56 | 63215BF01AB863B20040593C /* MasterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterViewController.swift; sourceTree = ""; }; 57 | 63215BF21AB863B20040593C /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = ""; }; 58 | 63215BF51AB863B20040593C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 59 | 63215BF71AB863B20040593C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 60 | 63215BFA1AB863B20040593C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 61 | 63215C001AB863B20040593C /* SwiftSummitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftSummitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | 63215C051AB863B20040593C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 63215BE31AB863B20040593C /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 63215BFD1AB863B20040593C /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | 631ABEC91ABDB4EB0070E2D9 /* MailService */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 631ABECB1ABDB51C0070E2D9 /* MailService.swift */, 87 | 631ABED51ABDB7470070E2D9 /* Account.swift */, 88 | 631ABED71ABDB7D60070E2D9 /* Message.swift */, 89 | 631ABED91ABDB8130070E2D9 /* OrderService.swift */, 90 | ); 91 | name = MailService; 92 | sourceTree = ""; 93 | }; 94 | 631ABEE11ABDE6AC0070E2D9 /* MailService */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | ); 98 | name = MailService; 99 | sourceTree = ""; 100 | }; 101 | 63215BDD1AB863B20040593C = { 102 | isa = PBXGroup; 103 | children = ( 104 | 63215BE81AB863B20040593C /* SwiftSummit */, 105 | 63215C031AB863B20040593C /* SwiftSummitTests */, 106 | 63215BE71AB863B20040593C /* Products */, 107 | ); 108 | sourceTree = ""; 109 | }; 110 | 63215BE71AB863B20040593C /* Products */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 63215BE61AB863B20040593C /* SwiftSummit.app */, 114 | 63215C001AB863B20040593C /* SwiftSummitTests.xctest */, 115 | ); 116 | name = Products; 117 | sourceTree = ""; 118 | }; 119 | 63215BE81AB863B20040593C /* SwiftSummit */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 631ABEC91ABDB4EB0070E2D9 /* MailService */, 123 | 63215BEB1AB863B20040593C /* AppDelegate.swift */, 124 | 63215BF01AB863B20040593C /* MasterViewController.swift */, 125 | 63215BF21AB863B20040593C /* DetailViewController.swift */, 126 | 63215BF41AB863B20040593C /* Main.storyboard */, 127 | 63215BF71AB863B20040593C /* Images.xcassets */, 128 | 63215BF91AB863B20040593C /* LaunchScreen.xib */, 129 | 63215BED1AB863B20040593C /* SwiftSummit.xcdatamodeld */, 130 | 63215BE91AB863B20040593C /* Supporting Files */, 131 | 631ABEDF1ABDCA980070E2D9 /* AnimationWithClosures.swift */, 132 | ); 133 | path = SwiftSummit; 134 | sourceTree = ""; 135 | }; 136 | 63215BE91AB863B20040593C /* Supporting Files */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 63215BEA1AB863B20040593C /* Info.plist */, 140 | ); 141 | name = "Supporting Files"; 142 | sourceTree = ""; 143 | }; 144 | 63215C031AB863B20040593C /* SwiftSummitTests */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 631ABEE11ABDE6AC0070E2D9 /* MailService */, 148 | 63215C041AB863B20040593C /* Supporting Files */, 149 | 631ABECD1ABDB5370070E2D9 /* MockTests.swift */, 150 | 631ABECF1ABDB5410070E2D9 /* FakeTests.swift */, 151 | 631ABED11ABDB54E0070E2D9 /* StubTests.swift */, 152 | 631ABEDB1ABDB8900070E2D9 /* AsyncTests.swift */, 153 | 631ABEDD1ABDCA040070E2D9 /* ReflectionTests.swift */, 154 | ); 155 | path = SwiftSummitTests; 156 | sourceTree = ""; 157 | }; 158 | 63215C041AB863B20040593C /* Supporting Files */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | 63215C051AB863B20040593C /* Info.plist */, 162 | ); 163 | name = "Supporting Files"; 164 | sourceTree = ""; 165 | }; 166 | /* End PBXGroup section */ 167 | 168 | /* Begin PBXNativeTarget section */ 169 | 63215BE51AB863B20040593C /* SwiftSummit */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 63215C0A1AB863B20040593C /* Build configuration list for PBXNativeTarget "SwiftSummit" */; 172 | buildPhases = ( 173 | 63215BE21AB863B20040593C /* Sources */, 174 | 63215BE31AB863B20040593C /* Frameworks */, 175 | 63215BE41AB863B20040593C /* Resources */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | ); 181 | name = SwiftSummit; 182 | productName = SwiftSummit; 183 | productReference = 63215BE61AB863B20040593C /* SwiftSummit.app */; 184 | productType = "com.apple.product-type.application"; 185 | }; 186 | 63215BFF1AB863B20040593C /* SwiftSummitTests */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = 63215C0D1AB863B20040593C /* Build configuration list for PBXNativeTarget "SwiftSummitTests" */; 189 | buildPhases = ( 190 | 63215BFC1AB863B20040593C /* Sources */, 191 | 63215BFD1AB863B20040593C /* Frameworks */, 192 | 63215BFE1AB863B20040593C /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | 63215C021AB863B20040593C /* PBXTargetDependency */, 198 | ); 199 | name = SwiftSummitTests; 200 | productName = SwiftSummitTests; 201 | productReference = 63215C001AB863B20040593C /* SwiftSummitTests.xctest */; 202 | productType = "com.apple.product-type.bundle.unit-test"; 203 | }; 204 | /* End PBXNativeTarget section */ 205 | 206 | /* Begin PBXProject section */ 207 | 63215BDE1AB863B20040593C /* Project object */ = { 208 | isa = PBXProject; 209 | attributes = { 210 | LastUpgradeCheck = 0630; 211 | ORGANIZATIONNAME = ThoughtWorks; 212 | TargetAttributes = { 213 | 63215BE51AB863B20040593C = { 214 | CreatedOnToolsVersion = 6.3; 215 | }; 216 | 63215BFF1AB863B20040593C = { 217 | CreatedOnToolsVersion = 6.3; 218 | TestTargetID = 63215BE51AB863B20040593C; 219 | }; 220 | }; 221 | }; 222 | buildConfigurationList = 63215BE11AB863B20040593C /* Build configuration list for PBXProject "SwiftSummit" */; 223 | compatibilityVersion = "Xcode 3.2"; 224 | developmentRegion = English; 225 | hasScannedForEncodings = 0; 226 | knownRegions = ( 227 | en, 228 | Base, 229 | ); 230 | mainGroup = 63215BDD1AB863B20040593C; 231 | productRefGroup = 63215BE71AB863B20040593C /* Products */; 232 | projectDirPath = ""; 233 | projectRoot = ""; 234 | targets = ( 235 | 63215BE51AB863B20040593C /* SwiftSummit */, 236 | 63215BFF1AB863B20040593C /* SwiftSummitTests */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | 63215BE41AB863B20040593C /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 63215BF61AB863B20040593C /* Main.storyboard in Resources */, 247 | 63215BFB1AB863B20040593C /* LaunchScreen.xib in Resources */, 248 | 63215BF81AB863B20040593C /* Images.xcassets in Resources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | 63215BFE1AB863B20040593C /* Resources */ = { 253 | isa = PBXResourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | /* End PBXResourcesBuildPhase section */ 260 | 261 | /* Begin PBXSourcesBuildPhase section */ 262 | 63215BE21AB863B20040593C /* Sources */ = { 263 | isa = PBXSourcesBuildPhase; 264 | buildActionMask = 2147483647; 265 | files = ( 266 | 631ABEE01ABDCA980070E2D9 /* AnimationWithClosures.swift in Sources */, 267 | 63215BEF1AB863B20040593C /* SwiftSummit.xcdatamodeld in Sources */, 268 | 63215BEC1AB863B20040593C /* AppDelegate.swift in Sources */, 269 | 631ABEDA1ABDB8130070E2D9 /* OrderService.swift in Sources */, 270 | 63215BF11AB863B20040593C /* MasterViewController.swift in Sources */, 271 | 631ABECC1ABDB51C0070E2D9 /* MailService.swift in Sources */, 272 | 63215BF31AB863B20040593C /* DetailViewController.swift in Sources */, 273 | 631ABED61ABDB7470070E2D9 /* Account.swift in Sources */, 274 | 631ABED81ABDB7D60070E2D9 /* Message.swift in Sources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | 63215BFC1AB863B20040593C /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 631ABED01ABDB5410070E2D9 /* FakeTests.swift in Sources */, 283 | 631ABECE1ABDB5370070E2D9 /* MockTests.swift in Sources */, 284 | 631ABEC71ABCA7B60070E2D9 /* AppDelegate.swift in Sources */, 285 | 631ABEC61ABCA17A0070E2D9 /* DetailViewController.swift in Sources */, 286 | 631ABEDC1ABDB8900070E2D9 /* AsyncTests.swift in Sources */, 287 | 631ABEDE1ABDCA040070E2D9 /* ReflectionTests.swift in Sources */, 288 | 631ABED21ABDB54E0070E2D9 /* StubTests.swift in Sources */, 289 | ); 290 | runOnlyForDeploymentPostprocessing = 0; 291 | }; 292 | /* End PBXSourcesBuildPhase section */ 293 | 294 | /* Begin PBXTargetDependency section */ 295 | 63215C021AB863B20040593C /* PBXTargetDependency */ = { 296 | isa = PBXTargetDependency; 297 | target = 63215BE51AB863B20040593C /* SwiftSummit */; 298 | targetProxy = 63215C011AB863B20040593C /* PBXContainerItemProxy */; 299 | }; 300 | /* End PBXTargetDependency section */ 301 | 302 | /* Begin PBXVariantGroup section */ 303 | 63215BF41AB863B20040593C /* Main.storyboard */ = { 304 | isa = PBXVariantGroup; 305 | children = ( 306 | 63215BF51AB863B20040593C /* Base */, 307 | ); 308 | name = Main.storyboard; 309 | sourceTree = ""; 310 | }; 311 | 63215BF91AB863B20040593C /* LaunchScreen.xib */ = { 312 | isa = PBXVariantGroup; 313 | children = ( 314 | 63215BFA1AB863B20040593C /* Base */, 315 | ); 316 | name = LaunchScreen.xib; 317 | sourceTree = ""; 318 | }; 319 | /* End PBXVariantGroup section */ 320 | 321 | /* Begin XCBuildConfiguration section */ 322 | 63215C081AB863B20040593C /* Debug */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ALWAYS_SEARCH_USER_PATHS = NO; 326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 327 | CLANG_CXX_LIBRARY = "libc++"; 328 | CLANG_ENABLE_MODULES = YES; 329 | CLANG_ENABLE_OBJC_ARC = YES; 330 | CLANG_WARN_BOOL_CONVERSION = YES; 331 | CLANG_WARN_CONSTANT_CONVERSION = YES; 332 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 333 | CLANG_WARN_EMPTY_BODY = YES; 334 | CLANG_WARN_ENUM_CONVERSION = YES; 335 | CLANG_WARN_INT_CONVERSION = YES; 336 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 337 | CLANG_WARN_UNREACHABLE_CODE = YES; 338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 340 | COPY_PHASE_STRIP = NO; 341 | DEBUG_INFORMATION_FORMAT = dwarf; 342 | ENABLE_STRICT_OBJC_MSGSEND = YES; 343 | GCC_C_LANGUAGE_STANDARD = gnu99; 344 | GCC_DYNAMIC_NO_PIC = NO; 345 | GCC_OPTIMIZATION_LEVEL = 0; 346 | GCC_PREPROCESSOR_DEFINITIONS = ( 347 | "DEBUG=1", 348 | "$(inherited)", 349 | ); 350 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 351 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 352 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 353 | GCC_WARN_UNDECLARED_SELECTOR = YES; 354 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 355 | GCC_WARN_UNUSED_FUNCTION = YES; 356 | GCC_WARN_UNUSED_VARIABLE = YES; 357 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 358 | MTL_ENABLE_DEBUG_INFO = YES; 359 | ONLY_ACTIVE_ARCH = YES; 360 | SDKROOT = iphoneos; 361 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 362 | TARGETED_DEVICE_FAMILY = "1,2"; 363 | }; 364 | name = Debug; 365 | }; 366 | 63215C091AB863B20040593C /* Release */ = { 367 | isa = XCBuildConfiguration; 368 | buildSettings = { 369 | ALWAYS_SEARCH_USER_PATHS = NO; 370 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 371 | CLANG_CXX_LIBRARY = "libc++"; 372 | CLANG_ENABLE_MODULES = YES; 373 | CLANG_ENABLE_OBJC_ARC = YES; 374 | CLANG_WARN_BOOL_CONVERSION = YES; 375 | CLANG_WARN_CONSTANT_CONVERSION = YES; 376 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 377 | CLANG_WARN_EMPTY_BODY = YES; 378 | CLANG_WARN_ENUM_CONVERSION = YES; 379 | CLANG_WARN_INT_CONVERSION = YES; 380 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 381 | CLANG_WARN_UNREACHABLE_CODE = YES; 382 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 383 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 384 | COPY_PHASE_STRIP = NO; 385 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 386 | ENABLE_NS_ASSERTIONS = NO; 387 | ENABLE_STRICT_OBJC_MSGSEND = YES; 388 | GCC_C_LANGUAGE_STANDARD = gnu99; 389 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 390 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 391 | GCC_WARN_UNDECLARED_SELECTOR = YES; 392 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 393 | GCC_WARN_UNUSED_FUNCTION = YES; 394 | GCC_WARN_UNUSED_VARIABLE = YES; 395 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 396 | MTL_ENABLE_DEBUG_INFO = NO; 397 | SDKROOT = iphoneos; 398 | TARGETED_DEVICE_FAMILY = "1,2"; 399 | VALIDATE_PRODUCT = YES; 400 | }; 401 | name = Release; 402 | }; 403 | 63215C0B1AB863B20040593C /* Debug */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 407 | INFOPLIST_FILE = SwiftSummit/Info.plist; 408 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 409 | PRODUCT_NAME = "$(TARGET_NAME)"; 410 | }; 411 | name = Debug; 412 | }; 413 | 63215C0C1AB863B20040593C /* Release */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | INFOPLIST_FILE = SwiftSummit/Info.plist; 418 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | }; 421 | name = Release; 422 | }; 423 | 63215C0E1AB863B20040593C /* Debug */ = { 424 | isa = XCBuildConfiguration; 425 | buildSettings = { 426 | BUNDLE_LOADER = "$(TEST_HOST)"; 427 | FRAMEWORK_SEARCH_PATHS = ( 428 | "$(SDKROOT)/Developer/Library/Frameworks", 429 | "$(inherited)", 430 | ); 431 | GCC_PREPROCESSOR_DEFINITIONS = ( 432 | "DEBUG=1", 433 | "$(inherited)", 434 | ); 435 | INFOPLIST_FILE = SwiftSummitTests/Info.plist; 436 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 437 | PRODUCT_NAME = "$(TARGET_NAME)"; 438 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftSummit.app/SwiftSummit"; 439 | }; 440 | name = Debug; 441 | }; 442 | 63215C0F1AB863B20040593C /* Release */ = { 443 | isa = XCBuildConfiguration; 444 | buildSettings = { 445 | BUNDLE_LOADER = "$(TEST_HOST)"; 446 | FRAMEWORK_SEARCH_PATHS = ( 447 | "$(SDKROOT)/Developer/Library/Frameworks", 448 | "$(inherited)", 449 | ); 450 | INFOPLIST_FILE = SwiftSummitTests/Info.plist; 451 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftSummit.app/SwiftSummit"; 454 | }; 455 | name = Release; 456 | }; 457 | /* End XCBuildConfiguration section */ 458 | 459 | /* Begin XCConfigurationList section */ 460 | 63215BE11AB863B20040593C /* Build configuration list for PBXProject "SwiftSummit" */ = { 461 | isa = XCConfigurationList; 462 | buildConfigurations = ( 463 | 63215C081AB863B20040593C /* Debug */, 464 | 63215C091AB863B20040593C /* Release */, 465 | ); 466 | defaultConfigurationIsVisible = 0; 467 | defaultConfigurationName = Release; 468 | }; 469 | 63215C0A1AB863B20040593C /* Build configuration list for PBXNativeTarget "SwiftSummit" */ = { 470 | isa = XCConfigurationList; 471 | buildConfigurations = ( 472 | 63215C0B1AB863B20040593C /* Debug */, 473 | 63215C0C1AB863B20040593C /* Release */, 474 | ); 475 | defaultConfigurationIsVisible = 0; 476 | defaultConfigurationName = Release; 477 | }; 478 | 63215C0D1AB863B20040593C /* Build configuration list for PBXNativeTarget "SwiftSummitTests" */ = { 479 | isa = XCConfigurationList; 480 | buildConfigurations = ( 481 | 63215C0E1AB863B20040593C /* Debug */, 482 | 63215C0F1AB863B20040593C /* Release */, 483 | ); 484 | defaultConfigurationIsVisible = 0; 485 | defaultConfigurationName = Release; 486 | }; 487 | /* End XCConfigurationList section */ 488 | 489 | /* Begin XCVersionGroup section */ 490 | 63215BED1AB863B20040593C /* SwiftSummit.xcdatamodeld */ = { 491 | isa = XCVersionGroup; 492 | children = ( 493 | 63215BEE1AB863B20040593C /* SwiftSummit.xcdatamodel */, 494 | ); 495 | currentVersion = 63215BEE1AB863B20040593C /* SwiftSummit.xcdatamodel */; 496 | path = SwiftSummit.xcdatamodeld; 497 | sourceTree = ""; 498 | versionGroupType = wrapper.xcdatamodel; 499 | }; 500 | /* End XCVersionGroup section */ 501 | }; 502 | rootObject = 63215BDE1AB863B20040593C /* Project object */; 503 | } 504 | -------------------------------------------------------------------------------- /SwiftSummit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftSummit.xcodeproj/project.xcworkspace/xcuserdata/jriehn.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lriehn/testing-in-swift/88b30962da2312812d4cf7cdfef486e18143171f/SwiftSummit.xcodeproj/project.xcworkspace/xcuserdata/jriehn.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SwiftSummit.xcodeproj/xcuserdata/jriehn.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /SwiftSummit.xcodeproj/xcuserdata/jriehn.xcuserdatad/xcschemes/SwiftSummit.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /SwiftSummit.xcodeproj/xcuserdata/jriehn.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SwiftSummit.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 63215BE51AB863B20040593C 16 | 17 | primary 18 | 19 | 20 | 63215BFF1AB863B20040593C 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SwiftSummit/Account.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public struct Account { 4 | let email: String 5 | let password: String 6 | 7 | public init(email: String, password: String) { 8 | self.email = email 9 | self.password = password 10 | } 11 | } -------------------------------------------------------------------------------- /SwiftSummit/AnimationWithClosures.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | 3 | class AnimationWithClosures { 4 | func animate(scale: (Void) -> Void, bounce: (Void) -> Void) { 5 | UIView.animateWithDuration(0.2, animations: { () -> Void in 6 | scale() 7 | }) 8 | { (success) -> Void in 9 | UIView.animateWithDuration(0.2, animations: { () -> Void in 10 | bounce() 11 | }) 12 | } 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /SwiftSummit/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftSummit 4 | // 5 | // Created by Jan Riehn on 17/03/2015. 6 | // Copyright (c) 2015 ThoughtWorks. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 19 | // Override point for customization after application launch. 20 | // let splitViewController = self.window!.rootViewController as! UISplitViewController 21 | // let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] as! UINavigationController 22 | // navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem() 23 | // splitViewController.delegate = self 24 | // 25 | // let masterNavigationController = splitViewController.viewControllers[0] as! UINavigationController 26 | // let controller = masterNavigationController.topViewController as! MasterViewController 27 | // controller.managedObjectContext = self.managedObjectContext 28 | return true 29 | } 30 | 31 | func applicationWillResignActive(application: UIApplication) { 32 | // 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. 33 | // 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. 34 | } 35 | 36 | func applicationDidEnterBackground(application: UIApplication) { 37 | // 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. 38 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 39 | } 40 | 41 | func applicationWillEnterForeground(application: UIApplication) { 42 | // 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. 43 | } 44 | 45 | func applicationDidBecomeActive(application: UIApplication) { 46 | // 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. 47 | } 48 | 49 | func applicationWillTerminate(application: UIApplication) { 50 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 51 | // Saves changes in the application's managed object context before the application terminates. 52 | self.saveContext() 53 | } 54 | 55 | // MARK: - Split view 56 | 57 | func splitViewController(splitViewController: UISplitViewController, collapseSecondaryViewController secondaryViewController:UIViewController!, ontoPrimaryViewController primaryViewController:UIViewController!) -> Bool { 58 | if let secondaryAsNavController = secondaryViewController as? UINavigationController { 59 | if let topAsDetailController = secondaryAsNavController.topViewController as? DetailViewController { 60 | if topAsDetailController.detailItem == nil { 61 | // Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded. 62 | return true 63 | } 64 | } 65 | } 66 | return false 67 | } 68 | // MARK: - Core Data stack 69 | 70 | lazy var applicationDocumentsDirectory: NSURL = { 71 | // The directory the application uses to store the Core Data store file. This code uses a directory named "tw.SwiftSummit" in the application's documents Application Support directory. 72 | let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) 73 | return urls[urls.count-1] as! NSURL 74 | }() 75 | 76 | lazy var managedObjectModel: NSManagedObjectModel = { 77 | // The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model. 78 | let modelURL = NSBundle.mainBundle().URLForResource("SwiftSummit", withExtension: "momd")! 79 | return NSManagedObjectModel(contentsOfURL: modelURL)! 80 | }() 81 | 82 | lazy var persistentStoreCoordinator: NSPersistentStoreCoordinator? = { 83 | // The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. This property is optional since there are legitimate error conditions that could cause the creation of the store to fail. 84 | // Create the coordinator and store 85 | var coordinator: NSPersistentStoreCoordinator? = NSPersistentStoreCoordinator(managedObjectModel: self.managedObjectModel) 86 | let url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("SwiftSummit.sqlite") 87 | var error: NSError? = nil 88 | var failureReason = "There was an error creating or loading the application's saved data." 89 | if coordinator!.addPersistentStoreWithType(NSSQLiteStoreType, configuration: nil, URL: url, options: nil, error: &error) == nil { 90 | coordinator = nil 91 | // Report any error we got. 92 | var dict = [String: AnyObject]() 93 | dict[NSLocalizedDescriptionKey] = "Failed to initialize the application's saved data" 94 | dict[NSLocalizedFailureReasonErrorKey] = failureReason 95 | dict[NSUnderlyingErrorKey] = error 96 | error = NSError(domain: "YOUR_ERROR_DOMAIN", code: 9999, userInfo: dict) 97 | // Replace this with code to handle the error appropriately. 98 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 99 | NSLog("Unresolved error \(error), \(error!.userInfo)") 100 | abort() 101 | } 102 | 103 | return coordinator 104 | }() 105 | 106 | lazy var managedObjectContext: NSManagedObjectContext? = { 107 | // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) This property is optional since there are legitimate error conditions that could cause the creation of the context to fail. 108 | let coordinator = self.persistentStoreCoordinator 109 | if coordinator == nil { 110 | return nil 111 | } 112 | var managedObjectContext = NSManagedObjectContext() 113 | managedObjectContext.persistentStoreCoordinator = coordinator 114 | return managedObjectContext 115 | }() 116 | 117 | // MARK: - Core Data Saving support 118 | 119 | func saveContext () { 120 | if let moc = self.managedObjectContext { 121 | var error: NSError? = nil 122 | if moc.hasChanges && !moc.save(&error) { 123 | // Replace this implementation with code to handle the error appropriately. 124 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 125 | NSLog("Unresolved error \(error), \(error!.userInfo)") 126 | abort() 127 | } 128 | } 129 | } 130 | 131 | } 132 | 133 | -------------------------------------------------------------------------------- /SwiftSummit/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /SwiftSummit/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | -------------------------------------------------------------------------------- /SwiftSummit/DetailViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DetailViewController.swift 3 | // SwiftSummit 4 | // 5 | // Created by Jan Riehn on 17/03/2015. 6 | // Copyright (c) 2015 ThoughtWorks. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class DetailViewController: UIViewController { 12 | 13 | @IBOutlet weak var detailDescriptionLabel: UILabel! 14 | 15 | 16 | var detailItem: AnyObject? { 17 | didSet { 18 | // Update the view. 19 | self.configureView() 20 | } 21 | } 22 | 23 | func configureView() { 24 | // Update the user interface for the detail item. 25 | if let detail: AnyObject = self.detailItem { 26 | if let label = self.detailDescriptionLabel { 27 | label.text = detail.valueForKey("timeStamp")!.description 28 | } 29 | } 30 | } 31 | 32 | func fadeOut(onCompletion: (Void) -> Void) { 33 | UIView.animateWithDuration(1.0, animations: { () -> Void in 34 | self.view.alpha = 0 35 | onCompletion() 36 | }) 37 | } 38 | 39 | override func viewDidLoad() { 40 | super.viewDidLoad() 41 | // Do any additional setup after loading the view, typically from a nib. 42 | self.configureView() 43 | } 44 | 45 | override func didReceiveMemoryWarning() { 46 | super.didReceiveMemoryWarning() 47 | // Dispose of any resources that can be recreated. 48 | } 49 | 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /SwiftSummit/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" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /SwiftSummit/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | tw.$(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 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UIStatusBarTintParameters 34 | 35 | UINavigationBar 36 | 37 | Style 38 | UIBarStyleDefault 39 | Translucent 40 | 41 | 42 | 43 | UISupportedInterfaceOrientations 44 | 45 | UIInterfaceOrientationPortrait 46 | UIInterfaceOrientationLandscapeLeft 47 | UIInterfaceOrientationLandscapeRight 48 | 49 | UISupportedInterfaceOrientations~ipad 50 | 51 | UIInterfaceOrientationPortrait 52 | UIInterfaceOrientationPortraitUpsideDown 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /SwiftSummit/MailService.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public protocol MailService { 4 | func send(msg: Message) 5 | } -------------------------------------------------------------------------------- /SwiftSummit/MasterViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MasterViewController.swift 3 | // SwiftSummit 4 | // 5 | // Created by Jan Riehn on 17/03/2015. 6 | // Copyright (c) 2015 ThoughtWorks. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | 12 | public class MasterViewController: UITableViewController, NSFetchedResultsControllerDelegate { 13 | 14 | var detailViewController: DetailViewController? = nil 15 | var managedObjectContext: NSManagedObjectContext? = nil 16 | 17 | 18 | override public func awakeFromNib() { 19 | super.awakeFromNib() 20 | if UIDevice.currentDevice().userInterfaceIdiom == .Pad { 21 | self.clearsSelectionOnViewWillAppear = false 22 | self.preferredContentSize = CGSize(width: 320.0, height: 600.0) 23 | } 24 | } 25 | 26 | override public func viewDidLoad() { 27 | super.viewDidLoad() 28 | // Do any additional setup after loading the view, typically from a nib. 29 | self.navigationItem.leftBarButtonItem = self.editButtonItem() 30 | 31 | let addButton = UIBarButtonItem(barButtonSystemItem: .Add, target: self, action: "insertNewObject:") 32 | self.navigationItem.rightBarButtonItem = addButton 33 | if let split = self.splitViewController { 34 | let controllers = split.viewControllers 35 | self.detailViewController = controllers[controllers.count-1].topViewController as? DetailViewController 36 | } 37 | } 38 | 39 | override public func didReceiveMemoryWarning() { 40 | super.didReceiveMemoryWarning() 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | func insertNewObject(sender: AnyObject) { 45 | let context = self.fetchedResultsController.managedObjectContext 46 | let entity = self.fetchedResultsController.fetchRequest.entity! 47 | let newManagedObject = NSEntityDescription.insertNewObjectForEntityForName(entity.name!, inManagedObjectContext: context) as! NSManagedObject 48 | 49 | // If appropriate, configure the new managed object. 50 | // Normally you should use accessor methods, but using KVC here avoids the need to add a custom class to the template. 51 | newManagedObject.setValue(NSDate(), forKey: "timeStamp") 52 | 53 | // Save the context. 54 | var error: NSError? = nil 55 | if !context.save(&error) { 56 | // Replace this implementation with code to handle the error appropriately. 57 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 58 | //println("Unresolved error \(error), \(error.userInfo)") 59 | abort() 60 | } 61 | } 62 | 63 | // MARK: - Segues 64 | 65 | override public func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { 66 | if segue.identifier == "showDetail" { 67 | if let indexPath = self.tableView.indexPathForSelectedRow() { 68 | let object = self.fetchedResultsController.objectAtIndexPath(indexPath) as! NSManagedObject 69 | let controller = (segue.destinationViewController as! UINavigationController).topViewController as! DetailViewController 70 | controller.detailItem = object 71 | controller.navigationItem.leftBarButtonItem = self.splitViewController?.displayModeButtonItem() 72 | controller.navigationItem.leftItemsSupplementBackButton = true 73 | } 74 | } 75 | } 76 | 77 | // MARK: - Table View 78 | 79 | override public func numberOfSectionsInTableView(tableView: UITableView) -> Int { 80 | return self.fetchedResultsController.sections?.count ?? 0 81 | } 82 | 83 | override public func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 84 | let sectionInfo = self.fetchedResultsController.sections![section] as! NSFetchedResultsSectionInfo 85 | return sectionInfo.numberOfObjects 86 | } 87 | 88 | override public func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 89 | let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as! UITableViewCell 90 | self.configureCell(cell, atIndexPath: indexPath) 91 | return cell 92 | } 93 | 94 | override public func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool { 95 | // Return false if you do not want the specified item to be editable. 96 | return true 97 | } 98 | 99 | override public func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) { 100 | if editingStyle == .Delete { 101 | let context = self.fetchedResultsController.managedObjectContext 102 | context.deleteObject(self.fetchedResultsController.objectAtIndexPath(indexPath) as! NSManagedObject) 103 | 104 | var error: NSError? = nil 105 | if !context.save(&error) { 106 | // Replace this implementation with code to handle the error appropriately. 107 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 108 | //println("Unresolved error \(error), \(error.userInfo)") 109 | abort() 110 | } 111 | } 112 | } 113 | 114 | func configureCell(cell: UITableViewCell, atIndexPath indexPath: NSIndexPath) { 115 | let object = self.fetchedResultsController.objectAtIndexPath(indexPath) as! NSManagedObject 116 | cell.textLabel!.text = object.valueForKey("timeStamp")!.description 117 | } 118 | 119 | // MARK: - Fetched results controller 120 | 121 | var fetchedResultsController: NSFetchedResultsController { 122 | if _fetchedResultsController != nil { 123 | return _fetchedResultsController! 124 | } 125 | 126 | let fetchRequest = NSFetchRequest() 127 | // Edit the entity name as appropriate. 128 | let entity = NSEntityDescription.entityForName("Event", inManagedObjectContext: self.managedObjectContext!) 129 | fetchRequest.entity = entity 130 | 131 | // Set the batch size to a suitable number. 132 | fetchRequest.fetchBatchSize = 20 133 | 134 | // Edit the sort key as appropriate. 135 | let sortDescriptor = NSSortDescriptor(key: "timeStamp", ascending: false) 136 | let sortDescriptors = [sortDescriptor] 137 | 138 | fetchRequest.sortDescriptors = [sortDescriptor] 139 | 140 | // Edit the section name key path and cache name if appropriate. 141 | // nil for section name key path means "no sections". 142 | let aFetchedResultsController = NSFetchedResultsController(fetchRequest: fetchRequest, managedObjectContext: self.managedObjectContext!, sectionNameKeyPath: nil, cacheName: "Master") 143 | aFetchedResultsController.delegate = self 144 | _fetchedResultsController = aFetchedResultsController 145 | 146 | var error: NSError? = nil 147 | if !_fetchedResultsController!.performFetch(&error) { 148 | // Replace this implementation with code to handle the error appropriately. 149 | // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. 150 | //println("Unresolved error \(error), \(error.userInfo)") 151 | abort() 152 | } 153 | 154 | return _fetchedResultsController! 155 | } 156 | var _fetchedResultsController: NSFetchedResultsController? = nil 157 | 158 | public func controllerWillChangeContent(controller: NSFetchedResultsController) { 159 | self.tableView.beginUpdates() 160 | } 161 | 162 | public func controller(controller: NSFetchedResultsController, didChangeSection sectionInfo: NSFetchedResultsSectionInfo, atIndex sectionIndex: Int, forChangeType type: NSFetchedResultsChangeType) { 163 | switch type { 164 | case .Insert: 165 | self.tableView.insertSections(NSIndexSet(index: sectionIndex), withRowAnimation: .Fade) 166 | case .Delete: 167 | self.tableView.deleteSections(NSIndexSet(index: sectionIndex), withRowAnimation: .Fade) 168 | default: 169 | return 170 | } 171 | } 172 | 173 | public func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) { 174 | switch type { 175 | case .Insert: 176 | tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Fade) 177 | case .Delete: 178 | tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Fade) 179 | case .Update: 180 | self.configureCell(tableView.cellForRowAtIndexPath(indexPath!)!, atIndexPath: indexPath!) 181 | case .Move: 182 | tableView.deleteRowsAtIndexPaths([indexPath!], withRowAnimation: .Fade) 183 | tableView.insertRowsAtIndexPaths([newIndexPath!], withRowAnimation: .Fade) 184 | default: 185 | return 186 | } 187 | } 188 | 189 | public func controllerDidChangeContent(controller: NSFetchedResultsController) { 190 | self.tableView.endUpdates() 191 | } 192 | 193 | /* 194 | // Implementing the above methods to update the table view in response to individual changes may have performance implications if a large number of changes are made simultaneously. If this proves to be an issue, you can instead just implement controllerDidChangeContent: which notifies the delegate that all section and object changes have been processed. 195 | 196 | func controllerDidChangeContent(controller: NSFetchedResultsController) { 197 | // In the simplest, most efficient, case, reload the table view. 198 | self.tableView.reloadData() 199 | } 200 | */ 201 | 202 | } 203 | 204 | -------------------------------------------------------------------------------- /SwiftSummit/Message.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public struct Message { 4 | 5 | } -------------------------------------------------------------------------------- /SwiftSummit/OrderService.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | public class OrderService { 4 | private var mailService: MailService 5 | 6 | public init(mailService: MailService) { 7 | self.mailService = mailService 8 | } 9 | 10 | public func submit(account: Account) { 11 | mailService.send(Message()) 12 | } 13 | } -------------------------------------------------------------------------------- /SwiftSummit/SwiftSummit.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | SwiftSummit.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftSummit/SwiftSummit.xcdatamodeld/SwiftSummit.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftSummitTests/AsyncTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftSummit 3 | 4 | class AsyncTests: XCTestCase { 5 | class AsyncDispatcher { 6 | func dispatch(#global: (Void) -> Void, main: (Void) -> Void) { 7 | let priority = DISPATCH_QUEUE_PRIORITY_DEFAULT 8 | dispatch_async(dispatch_get_global_queue(priority, 0)) { 9 | global() 10 | dispatch_async(dispatch_get_main_queue()) { 11 | main() 12 | } 13 | } 14 | } 15 | } 16 | 17 | func testShouldCallGlobalAndMainDispatch() { 18 | //given 19 | var dispatcher = AsyncDispatcher() 20 | var calledCallbacks: [String] = [] 21 | var expectation = expectationWithDescription("") 22 | 23 | //when 24 | dispatcher.dispatch( 25 | global: { () -> Void in 26 | calledCallbacks.append("global") 27 | }, main: { () -> Void in 28 | calledCallbacks.append("main") 29 | expectation.fulfill() 30 | } 31 | ) 32 | waitForExpectationsWithTimeout(5, handler: nil) 33 | 34 | //then 35 | XCTAssertEqual(calledCallbacks, ["global", "main"]) 36 | } 37 | 38 | 39 | 40 | func testShouldReceiveDataFromSwiftSummit() { 41 | let url = NSURL(string: "http:/swiftsummit.com")! 42 | var dataReceived: NSData? = nil 43 | 44 | let task = NSURLSession.sharedSession().dataTaskWithURL(url) {(data, response, error) in 45 | XCTAssertTrue(false) 46 | } 47 | task.resume() 48 | } 49 | } -------------------------------------------------------------------------------- /SwiftSummitTests/FakeTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftSummit 3 | 4 | class FakeTests: XCTestCase { 5 | 6 | } -------------------------------------------------------------------------------- /SwiftSummitTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | tw.$(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 | -------------------------------------------------------------------------------- /SwiftSummitTests/MockTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftSummit 3 | 4 | class MockTests: XCTestCase { 5 | 6 | } -------------------------------------------------------------------------------- /SwiftSummitTests/ReflectionTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | class ReflectionTests: XCTestCase { 4 | 5 | } -------------------------------------------------------------------------------- /SwiftSummitTests/StubTests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import SwiftSummit 3 | 4 | class StubTests: XCTestCase { 5 | class MailServiceStub: MailService { 6 | private var messages: [Message] = [] 7 | 8 | func send(msg: Message) { 9 | messages.append(msg) 10 | } 11 | 12 | func numberSent() -> Int { 13 | return messages.count 14 | } 15 | } 16 | 17 | func testShouldSendMailAfterOrderSubmitted() { 18 | //given 19 | let mailServiceStub = MailServiceStub() 20 | let orderService = OrderService(mailService: mailServiceStub) 21 | 22 | //when 23 | orderService.submit(Account(email: "", password: "")) 24 | 25 | //then 26 | XCTAssertEqual(1, mailServiceStub.numberSent()) 27 | } 28 | } --------------------------------------------------------------------------------