├── README.md ├── SwiftExample.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── SwiftExample.xccheckout │ └── xcuserdata │ │ └── Sachin.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Sachin.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── SwiftExample.xcscheme │ └── xcschememanagement.plist ├── SwiftExample ├── AppDelegate.swift ├── Base.lproj │ └── Main.storyboard ├── CameraViewController.swift ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── Info.plist ├── MapViewController.swift ├── TableViewController.swift ├── ViewController.swift └── WebViewController.swift └── SwiftExampleTests ├── Info.plist └── SwiftExampleTests.swift /README.md: -------------------------------------------------------------------------------- 1 | SwiftExample 2 | ============ 3 | 4 | A small iOS app to demonstrate the use of table views, web views, map views and camera views using Swift, the new programming language for iOS development. 5 | 6 | Your one stop shop for all things Swift. 7 | 8 |

Features:

9 | 10 | - Camera view - ability to take pictures and save to camera roll 11 | - Table view - ability to select and delete table view cells 12 | - Web view - ability to view a web page within the app 13 | - Map view- ability to geocode an address string and display it on a map 14 | -------------------------------------------------------------------------------- /SwiftExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 031A8D77193DB57D00F4A6D2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031A8D76193DB57D00F4A6D2 /* AppDelegate.swift */; }; 11 | 031A8D79193DB57D00F4A6D2 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031A8D78193DB57D00F4A6D2 /* ViewController.swift */; }; 12 | 031A8D7C193DB57D00F4A6D2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 031A8D7A193DB57D00F4A6D2 /* Main.storyboard */; }; 13 | 031A8D7E193DB57D00F4A6D2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 031A8D7D193DB57D00F4A6D2 /* Images.xcassets */; }; 14 | 031A8D8A193DB57D00F4A6D2 /* SwiftExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031A8D89193DB57D00F4A6D2 /* SwiftExampleTests.swift */; }; 15 | 031A8D94193DCBE900F4A6D2 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031A8D93193DCBE900F4A6D2 /* TableViewController.swift */; }; 16 | 031A8D9A193DDD4100F4A6D2 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031A8D99193DDD4100F4A6D2 /* WebViewController.swift */; }; 17 | 03345B6A19755286002C0FF7 /* MapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03345B6919755286002C0FF7 /* MapViewController.swift */; }; 18 | 03345B6C197552AF002C0FF7 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03345B6B197552AF002C0FF7 /* MapKit.framework */; }; 19 | 03B0EEB119595EF00048D16D /* CameraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03B0EEB019595EF00048D16D /* CameraViewController.swift */; }; 20 | 03C94697195AC0C70055D2FC /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03C94696195AC0C70055D2FC /* MobileCoreServices.framework */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXContainerItemProxy section */ 24 | 031A8D84193DB57D00F4A6D2 /* PBXContainerItemProxy */ = { 25 | isa = PBXContainerItemProxy; 26 | containerPortal = 031A8D69193DB57D00F4A6D2 /* Project object */; 27 | proxyType = 1; 28 | remoteGlobalIDString = 031A8D70193DB57D00F4A6D2; 29 | remoteInfo = SwiftExample; 30 | }; 31 | /* End PBXContainerItemProxy section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 031A8D71193DB57D00F4A6D2 /* SwiftExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 031A8D75193DB57D00F4A6D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 031A8D76193DB57D00F4A6D2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 031A8D78193DB57D00F4A6D2 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 38 | 031A8D7B193DB57D00F4A6D2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 39 | 031A8D7D193DB57D00F4A6D2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 40 | 031A8D83193DB57D00F4A6D2 /* SwiftExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 031A8D88193DB57D00F4A6D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 031A8D89193DB57D00F4A6D2 /* SwiftExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExampleTests.swift; sourceTree = ""; }; 43 | 031A8D93193DCBE900F4A6D2 /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; 44 | 031A8D99193DDD4100F4A6D2 /* WebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = ""; }; 45 | 03345B6919755286002C0FF7 /* MapViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapViewController.swift; sourceTree = ""; }; 46 | 03345B6B197552AF002C0FF7 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; 47 | 03B0EEB019595EF00048D16D /* CameraViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraViewController.swift; sourceTree = ""; }; 48 | 03C94696195AC0C70055D2FC /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | 031A8D6E193DB57D00F4A6D2 /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | 03345B6C197552AF002C0FF7 /* MapKit.framework in Frameworks */, 57 | 03C94697195AC0C70055D2FC /* MobileCoreServices.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | 031A8D80193DB57D00F4A6D2 /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 031A8D68193DB57D00F4A6D2 = { 72 | isa = PBXGroup; 73 | children = ( 74 | 03345B6B197552AF002C0FF7 /* MapKit.framework */, 75 | 03C94696195AC0C70055D2FC /* MobileCoreServices.framework */, 76 | 031A8D73193DB57D00F4A6D2 /* SwiftExample */, 77 | 031A8D86193DB57D00F4A6D2 /* SwiftExampleTests */, 78 | 031A8D72193DB57D00F4A6D2 /* Products */, 79 | ); 80 | sourceTree = ""; 81 | }; 82 | 031A8D72193DB57D00F4A6D2 /* Products */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | 031A8D71193DB57D00F4A6D2 /* SwiftExample.app */, 86 | 031A8D83193DB57D00F4A6D2 /* SwiftExampleTests.xctest */, 87 | ); 88 | name = Products; 89 | sourceTree = ""; 90 | }; 91 | 031A8D73193DB57D00F4A6D2 /* SwiftExample */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 031A8D76193DB57D00F4A6D2 /* AppDelegate.swift */, 95 | 031A8D78193DB57D00F4A6D2 /* ViewController.swift */, 96 | 03345B6919755286002C0FF7 /* MapViewController.swift */, 97 | 031A8D7A193DB57D00F4A6D2 /* Main.storyboard */, 98 | 03B0EEB019595EF00048D16D /* CameraViewController.swift */, 99 | 031A8D99193DDD4100F4A6D2 /* WebViewController.swift */, 100 | 031A8D93193DCBE900F4A6D2 /* TableViewController.swift */, 101 | 031A8D7D193DB57D00F4A6D2 /* Images.xcassets */, 102 | 031A8D74193DB57D00F4A6D2 /* Supporting Files */, 103 | ); 104 | path = SwiftExample; 105 | sourceTree = ""; 106 | }; 107 | 031A8D74193DB57D00F4A6D2 /* Supporting Files */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 031A8D75193DB57D00F4A6D2 /* Info.plist */, 111 | ); 112 | name = "Supporting Files"; 113 | sourceTree = ""; 114 | }; 115 | 031A8D86193DB57D00F4A6D2 /* SwiftExampleTests */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 031A8D89193DB57D00F4A6D2 /* SwiftExampleTests.swift */, 119 | 031A8D87193DB57D00F4A6D2 /* Supporting Files */, 120 | ); 121 | path = SwiftExampleTests; 122 | sourceTree = ""; 123 | }; 124 | 031A8D87193DB57D00F4A6D2 /* Supporting Files */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 031A8D88193DB57D00F4A6D2 /* Info.plist */, 128 | ); 129 | name = "Supporting Files"; 130 | sourceTree = ""; 131 | }; 132 | /* End PBXGroup section */ 133 | 134 | /* Begin PBXNativeTarget section */ 135 | 031A8D70193DB57D00F4A6D2 /* SwiftExample */ = { 136 | isa = PBXNativeTarget; 137 | buildConfigurationList = 031A8D8D193DB57D00F4A6D2 /* Build configuration list for PBXNativeTarget "SwiftExample" */; 138 | buildPhases = ( 139 | 031A8D6D193DB57D00F4A6D2 /* Sources */, 140 | 031A8D6E193DB57D00F4A6D2 /* Frameworks */, 141 | 031A8D6F193DB57D00F4A6D2 /* Resources */, 142 | ); 143 | buildRules = ( 144 | ); 145 | dependencies = ( 146 | ); 147 | name = SwiftExample; 148 | productName = SwiftExample; 149 | productReference = 031A8D71193DB57D00F4A6D2 /* SwiftExample.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | 031A8D82193DB57D00F4A6D2 /* SwiftExampleTests */ = { 153 | isa = PBXNativeTarget; 154 | buildConfigurationList = 031A8D90193DB57D00F4A6D2 /* Build configuration list for PBXNativeTarget "SwiftExampleTests" */; 155 | buildPhases = ( 156 | 031A8D7F193DB57D00F4A6D2 /* Sources */, 157 | 031A8D80193DB57D00F4A6D2 /* Frameworks */, 158 | 031A8D81193DB57D00F4A6D2 /* Resources */, 159 | ); 160 | buildRules = ( 161 | ); 162 | dependencies = ( 163 | 031A8D85193DB57D00F4A6D2 /* PBXTargetDependency */, 164 | ); 165 | name = SwiftExampleTests; 166 | productName = SwiftExampleTests; 167 | productReference = 031A8D83193DB57D00F4A6D2 /* SwiftExampleTests.xctest */; 168 | productType = "com.apple.product-type.bundle.unit-test"; 169 | }; 170 | /* End PBXNativeTarget section */ 171 | 172 | /* Begin PBXProject section */ 173 | 031A8D69193DB57D00F4A6D2 /* Project object */ = { 174 | isa = PBXProject; 175 | attributes = { 176 | LastUpgradeCheck = 0600; 177 | ORGANIZATIONNAME = "Sachin Kesiraju"; 178 | TargetAttributes = { 179 | 031A8D70193DB57D00F4A6D2 = { 180 | CreatedOnToolsVersion = 6.0; 181 | }; 182 | 031A8D82193DB57D00F4A6D2 = { 183 | CreatedOnToolsVersion = 6.0; 184 | TestTargetID = 031A8D70193DB57D00F4A6D2; 185 | }; 186 | }; 187 | }; 188 | buildConfigurationList = 031A8D6C193DB57D00F4A6D2 /* Build configuration list for PBXProject "SwiftExample" */; 189 | compatibilityVersion = "Xcode 3.2"; 190 | developmentRegion = English; 191 | hasScannedForEncodings = 0; 192 | knownRegions = ( 193 | en, 194 | Base, 195 | ); 196 | mainGroup = 031A8D68193DB57D00F4A6D2; 197 | productRefGroup = 031A8D72193DB57D00F4A6D2 /* Products */; 198 | projectDirPath = ""; 199 | projectRoot = ""; 200 | targets = ( 201 | 031A8D70193DB57D00F4A6D2 /* SwiftExample */, 202 | 031A8D82193DB57D00F4A6D2 /* SwiftExampleTests */, 203 | ); 204 | }; 205 | /* End PBXProject section */ 206 | 207 | /* Begin PBXResourcesBuildPhase section */ 208 | 031A8D6F193DB57D00F4A6D2 /* Resources */ = { 209 | isa = PBXResourcesBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | 031A8D7C193DB57D00F4A6D2 /* Main.storyboard in Resources */, 213 | 031A8D7E193DB57D00F4A6D2 /* Images.xcassets in Resources */, 214 | ); 215 | runOnlyForDeploymentPostprocessing = 0; 216 | }; 217 | 031A8D81193DB57D00F4A6D2 /* Resources */ = { 218 | isa = PBXResourcesBuildPhase; 219 | buildActionMask = 2147483647; 220 | files = ( 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | /* End PBXResourcesBuildPhase section */ 225 | 226 | /* Begin PBXSourcesBuildPhase section */ 227 | 031A8D6D193DB57D00F4A6D2 /* Sources */ = { 228 | isa = PBXSourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | 031A8D79193DB57D00F4A6D2 /* ViewController.swift in Sources */, 232 | 03345B6A19755286002C0FF7 /* MapViewController.swift in Sources */, 233 | 031A8D94193DCBE900F4A6D2 /* TableViewController.swift in Sources */, 234 | 031A8D77193DB57D00F4A6D2 /* AppDelegate.swift in Sources */, 235 | 031A8D9A193DDD4100F4A6D2 /* WebViewController.swift in Sources */, 236 | 03B0EEB119595EF00048D16D /* CameraViewController.swift in Sources */, 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | 031A8D7F193DB57D00F4A6D2 /* Sources */ = { 241 | isa = PBXSourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | 031A8D8A193DB57D00F4A6D2 /* SwiftExampleTests.swift in Sources */, 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | /* End PBXSourcesBuildPhase section */ 249 | 250 | /* Begin PBXTargetDependency section */ 251 | 031A8D85193DB57D00F4A6D2 /* PBXTargetDependency */ = { 252 | isa = PBXTargetDependency; 253 | target = 031A8D70193DB57D00F4A6D2 /* SwiftExample */; 254 | targetProxy = 031A8D84193DB57D00F4A6D2 /* PBXContainerItemProxy */; 255 | }; 256 | /* End PBXTargetDependency section */ 257 | 258 | /* Begin PBXVariantGroup section */ 259 | 031A8D7A193DB57D00F4A6D2 /* Main.storyboard */ = { 260 | isa = PBXVariantGroup; 261 | children = ( 262 | 031A8D7B193DB57D00F4A6D2 /* Base */, 263 | ); 264 | name = Main.storyboard; 265 | sourceTree = ""; 266 | }; 267 | /* End PBXVariantGroup section */ 268 | 269 | /* Begin XCBuildConfiguration section */ 270 | 031A8D8B193DB57D00F4A6D2 /* Debug */ = { 271 | isa = XCBuildConfiguration; 272 | buildSettings = { 273 | ALWAYS_SEARCH_USER_PATHS = NO; 274 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 275 | CLANG_CXX_LIBRARY = "libc++"; 276 | CLANG_ENABLE_MODULES = YES; 277 | CLANG_ENABLE_OBJC_ARC = YES; 278 | CLANG_WARN_BOOL_CONVERSION = YES; 279 | CLANG_WARN_CONSTANT_CONVERSION = YES; 280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 281 | CLANG_WARN_EMPTY_BODY = YES; 282 | CLANG_WARN_ENUM_CONVERSION = YES; 283 | CLANG_WARN_INT_CONVERSION = YES; 284 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 285 | CLANG_WARN_UNREACHABLE_CODE = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = NO; 289 | ENABLE_STRICT_OBJC_MSGSEND = YES; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_DYNAMIC_NO_PIC = NO; 292 | GCC_OPTIMIZATION_LEVEL = 0; 293 | GCC_PREPROCESSOR_DEFINITIONS = ( 294 | "DEBUG=1", 295 | "$(inherited)", 296 | ); 297 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 305 | METAL_ENABLE_DEBUG_INFO = YES; 306 | ONLY_ACTIVE_ARCH = YES; 307 | SDKROOT = iphoneos; 308 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 309 | }; 310 | name = Debug; 311 | }; 312 | 031A8D8C193DB57D00F4A6D2 /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ALWAYS_SEARCH_USER_PATHS = NO; 316 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 317 | CLANG_CXX_LIBRARY = "libc++"; 318 | CLANG_ENABLE_MODULES = YES; 319 | CLANG_ENABLE_OBJC_ARC = YES; 320 | CLANG_WARN_BOOL_CONVERSION = YES; 321 | CLANG_WARN_CONSTANT_CONVERSION = YES; 322 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 323 | CLANG_WARN_EMPTY_BODY = YES; 324 | CLANG_WARN_ENUM_CONVERSION = YES; 325 | CLANG_WARN_INT_CONVERSION = YES; 326 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 327 | CLANG_WARN_UNREACHABLE_CODE = YES; 328 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 329 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 330 | COPY_PHASE_STRIP = YES; 331 | ENABLE_NS_ASSERTIONS = NO; 332 | ENABLE_STRICT_OBJC_MSGSEND = YES; 333 | GCC_C_LANGUAGE_STANDARD = gnu99; 334 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 335 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 336 | GCC_WARN_UNDECLARED_SELECTOR = YES; 337 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 338 | GCC_WARN_UNUSED_FUNCTION = YES; 339 | GCC_WARN_UNUSED_VARIABLE = YES; 340 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 341 | METAL_ENABLE_DEBUG_INFO = NO; 342 | SDKROOT = iphoneos; 343 | VALIDATE_PRODUCT = YES; 344 | }; 345 | name = Release; 346 | }; 347 | 031A8D8E193DB57D00F4A6D2 /* Debug */ = { 348 | isa = XCBuildConfiguration; 349 | buildSettings = { 350 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 351 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 352 | INFOPLIST_FILE = SwiftExample/Info.plist; 353 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 354 | PRODUCT_NAME = "$(TARGET_NAME)"; 355 | }; 356 | name = Debug; 357 | }; 358 | 031A8D8F193DB57D00F4A6D2 /* Release */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 362 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 363 | INFOPLIST_FILE = SwiftExample/Info.plist; 364 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 365 | PRODUCT_NAME = "$(TARGET_NAME)"; 366 | }; 367 | name = Release; 368 | }; 369 | 031A8D91193DB57D00F4A6D2 /* Debug */ = { 370 | isa = XCBuildConfiguration; 371 | buildSettings = { 372 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample"; 373 | FRAMEWORK_SEARCH_PATHS = ( 374 | "$(SDKROOT)/Developer/Library/Frameworks", 375 | "$(inherited)", 376 | ); 377 | GCC_PREPROCESSOR_DEFINITIONS = ( 378 | "DEBUG=1", 379 | "$(inherited)", 380 | ); 381 | INFOPLIST_FILE = SwiftExampleTests/Info.plist; 382 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 383 | METAL_ENABLE_DEBUG_INFO = YES; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | TEST_HOST = "$(BUNDLE_LOADER)"; 386 | }; 387 | name = Debug; 388 | }; 389 | 031A8D92193DB57D00F4A6D2 /* Release */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/SwiftExample.app/SwiftExample"; 393 | FRAMEWORK_SEARCH_PATHS = ( 394 | "$(SDKROOT)/Developer/Library/Frameworks", 395 | "$(inherited)", 396 | ); 397 | INFOPLIST_FILE = SwiftExampleTests/Info.plist; 398 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 399 | METAL_ENABLE_DEBUG_INFO = NO; 400 | PRODUCT_NAME = "$(TARGET_NAME)"; 401 | TEST_HOST = "$(BUNDLE_LOADER)"; 402 | }; 403 | name = Release; 404 | }; 405 | /* End XCBuildConfiguration section */ 406 | 407 | /* Begin XCConfigurationList section */ 408 | 031A8D6C193DB57D00F4A6D2 /* Build configuration list for PBXProject "SwiftExample" */ = { 409 | isa = XCConfigurationList; 410 | buildConfigurations = ( 411 | 031A8D8B193DB57D00F4A6D2 /* Debug */, 412 | 031A8D8C193DB57D00F4A6D2 /* Release */, 413 | ); 414 | defaultConfigurationIsVisible = 0; 415 | defaultConfigurationName = Release; 416 | }; 417 | 031A8D8D193DB57D00F4A6D2 /* Build configuration list for PBXNativeTarget "SwiftExample" */ = { 418 | isa = XCConfigurationList; 419 | buildConfigurations = ( 420 | 031A8D8E193DB57D00F4A6D2 /* Debug */, 421 | 031A8D8F193DB57D00F4A6D2 /* Release */, 422 | ); 423 | defaultConfigurationIsVisible = 0; 424 | defaultConfigurationName = Release; 425 | }; 426 | 031A8D90193DB57D00F4A6D2 /* Build configuration list for PBXNativeTarget "SwiftExampleTests" */ = { 427 | isa = XCConfigurationList; 428 | buildConfigurations = ( 429 | 031A8D91193DB57D00F4A6D2 /* Debug */, 430 | 031A8D92193DB57D00F4A6D2 /* Release */, 431 | ); 432 | defaultConfigurationIsVisible = 0; 433 | defaultConfigurationName = Release; 434 | }; 435 | /* End XCConfigurationList section */ 436 | }; 437 | rootObject = 031A8D69193DB57D00F4A6D2 /* Project object */; 438 | } 439 | -------------------------------------------------------------------------------- /SwiftExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftExample.xcodeproj/project.xcworkspace/xcshareddata/SwiftExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 207A71C7-0C9B-4DA8-99B6-0A6BC1D3DC1C 9 | IDESourceControlProjectName 10 | SwiftExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | FF37E7162EB7D2BBDB58A5670D9580FEF7857AC6 14 | https://github.com/sachinkesiraju/SwiftExample.git 15 | 16 | IDESourceControlProjectPath 17 | SwiftExample.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | FF37E7162EB7D2BBDB58A5670D9580FEF7857AC6 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/sachinkesiraju/SwiftExample.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | FF37E7162EB7D2BBDB58A5670D9580FEF7857AC6 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | FF37E7162EB7D2BBDB58A5670D9580FEF7857AC6 36 | IDESourceControlWCCName 37 | SwiftExample 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /SwiftExample.xcodeproj/project.xcworkspace/xcuserdata/Sachin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sachinkesiraju/SwiftExample/920421c93a31c4e5b30f60add418f8b65f3f7a76/SwiftExample.xcodeproj/project.xcworkspace/xcuserdata/Sachin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /SwiftExample.xcodeproj/xcuserdata/Sachin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /SwiftExample.xcodeproj/xcuserdata/Sachin.xcuserdatad/xcschemes/SwiftExample.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 | -------------------------------------------------------------------------------- /SwiftExample.xcodeproj/xcuserdata/Sachin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SwiftExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 031A8D70193DB57D00F4A6D2 16 | 17 | primary 18 | 19 | 20 | 031A8D82193DB57D00F4A6D2 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /SwiftExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftExample 4 | // 5 | // Created by Sachin Kesiraju on 6/3/14. 6 | // Copyright (c) 2014 Sachin Kesiraju. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool { 17 | return true; 18 | } 19 | 20 | func applicationWillResignActive(application: UIApplication) { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | func applicationDidEnterBackground(application: UIApplication) { 26 | // 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. 27 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 28 | } 29 | 30 | func applicationWillEnterForeground(application: UIApplication) { 31 | // 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. 32 | } 33 | 34 | func applicationDidBecomeActive(application: UIApplication) { 35 | // 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. 36 | } 37 | 38 | func applicationWillTerminate(application: UIApplication) { 39 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 40 | } 41 | 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /SwiftExample/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 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 64 | 73 | 82 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | -------------------------------------------------------------------------------- /SwiftExample/CameraViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CameraViewController.swift 3 | // SwiftExample 4 | // 5 | // Created by Sachin Kesiraju on 6/24/14. 6 | // Copyright (c) 2014 Sachin Kesiraju. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import MobileCoreServices 11 | 12 | class CameraViewController: UIViewController, UIImagePickerControllerDelegate, UIAlertViewDelegate, UINavigationControllerDelegate { 13 | 14 | @IBOutlet var backgroundImage:UIImageView? 15 | 16 | var cameraUI:UIImagePickerController = UIImagePickerController() 17 | 18 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { 19 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 20 | // Custom initialization 21 | } 22 | 23 | required init(coder aDecoder: NSCoder) 24 | { 25 | super.init(coder: aDecoder) 26 | } 27 | 28 | //pragma mark - View 29 | 30 | override func viewDidLoad() { 31 | super.viewDidLoad() 32 | self.presentCamera() 33 | // Do any additional setup after loading the view. 34 | } 35 | 36 | override func didReceiveMemoryWarning() { 37 | super.didReceiveMemoryWarning() 38 | // Dispose of any resources that can be recreated. 39 | } 40 | 41 | @IBAction func cameraShow() 42 | { 43 | self.presentCamera() 44 | } 45 | 46 | //pragma mark - Camera 47 | 48 | func presentCamera() 49 | { 50 | cameraUI = UIImagePickerController() 51 | cameraUI.delegate = self 52 | cameraUI.sourceType = UIImagePickerControllerSourceType.Camera 53 | cameraUI.mediaTypes = [kUTTypeImage] 54 | cameraUI.allowsEditing = false 55 | 56 | self.presentViewController(cameraUI, animated: true, completion: nil) 57 | } 58 | 59 | //pragma mark- Image 60 | 61 | func imagePickerControllerDidCancel(picker:UIImagePickerController) 62 | { 63 | self.dismissViewControllerAnimated(true, completion: nil) 64 | } 65 | 66 | func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage!, editingInfo: [NSObject : AnyObject]!) { 67 | var mediaType:String = editingInfo[UIImagePickerControllerEditedImage] as! String 68 | var imageToSave:UIImage 69 | 70 | imageToSave = editingInfo[UIImagePickerControllerOriginalImage]as! UIImage 71 | 72 | UIImageWriteToSavedPhotosAlbum(imageToSave, nil, nil, nil) 73 | self.savedImage() 74 | self.dismissViewControllerAnimated(true, completion: nil) 75 | } 76 | 77 | func savedImage() 78 | { 79 | var alert:UIAlertView = UIAlertView() 80 | alert.title = "Saved!" 81 | alert.message = "Your picture was saved to Camera Roll" 82 | alert.delegate = self 83 | alert.addButtonWithTitle("Awesome") 84 | alert.show() 85 | } 86 | 87 | func alertView(alertView: UIAlertView!, didDismissWithButtonIndex buttonIndex: Int) 88 | { 89 | NSLog("Did dismiss button: %d", buttonIndex) 90 | self.presentCamera() 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /SwiftExample/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 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SwiftExample/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 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /SwiftExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | Sachin.Kesiraju.${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 | 32 | 33 | -------------------------------------------------------------------------------- /SwiftExample/MapViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MapViewController.swift 3 | // SwiftExample 4 | // 5 | // Created by Sachin Kesiraju on 7/15/14. 6 | // Copyright (c) 2014 Sachin Kesiraju. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import MapKit 11 | import CoreLocation 12 | 13 | class MapViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate { 14 | 15 | @IBOutlet var mapView : MKMapView? 16 | 17 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { 18 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 19 | // Custom initialization 20 | } 21 | 22 | required init(coder aDecoder: NSCoder) { 23 | super.init(coder: aDecoder) 24 | } 25 | 26 | override func viewDidLoad() { 27 | super.viewDidLoad() 28 | // Do any additional setup after loading the view. 29 | 30 | // self.mapView.delegate = self 31 | let location = "1 Infinity Loop, Cupertino, CA" 32 | var geocoder:CLGeocoder = CLGeocoder() 33 | geocoder.geocodeAddressString(location, completionHandler: {(placemarks, error) -> Void in 34 | 35 | if((error) != nil){ 36 | 37 | println("Error", error) 38 | } 39 | 40 | else if let placemark = placemarks?[0] as? CLPlacemark { 41 | 42 | var placemark:CLPlacemark = placemarks[0] as! CLPlacemark 43 | var coordinates:CLLocationCoordinate2D = placemark.location.coordinate 44 | 45 | var pointAnnotation:MKPointAnnotation = MKPointAnnotation() 46 | pointAnnotation.coordinate = coordinates 47 | pointAnnotation.title = "Apple HQ" 48 | 49 | self.mapView?.addAnnotation(pointAnnotation) 50 | self.mapView?.centerCoordinate = coordinates 51 | self.mapView?.selectAnnotation(pointAnnotation, animated: true) 52 | 53 | println("Added annotation to map view") 54 | } 55 | 56 | }) 57 | } 58 | 59 | func mapView (mapView: MKMapView!, 60 | viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! { 61 | 62 | var pinView:MKPinAnnotationView = MKPinAnnotationView() 63 | pinView.annotation = annotation 64 | pinView.pinColor = MKPinAnnotationColor.Red 65 | pinView.animatesDrop = true 66 | pinView.canShowCallout = true 67 | 68 | return pinView 69 | } 70 | 71 | func mapView(mapView: MKMapView!, 72 | didSelectAnnotationView view: MKAnnotationView!){ 73 | 74 | println("Selected annotation") 75 | } 76 | 77 | override func didReceiveMemoryWarning() { 78 | super.didReceiveMemoryWarning() 79 | // Dispose of any resources that can be recreated. 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /SwiftExample/TableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.swift 3 | // SwiftExample 4 | // 5 | // Created by Sachin Kesiraju on 6/3/14. 6 | // Copyright (c) 2014 Sachin Kesiraju. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class TableViewController: UITableViewController { 12 | 13 | var tableArray:NSMutableArray = ["Swift", "Objective -C", "Python", "Java", "Ruby"] 14 | 15 | override init(style: UITableViewStyle) { 16 | super.init(style: style) 17 | // Custom initialization 18 | } 19 | 20 | required init(coder aDecoder: NSCoder) { 21 | super.init(coder: aDecoder) 22 | } 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | 27 | self.title = "Table View" 28 | } 29 | 30 | override func viewDidAppear(animated: Bool) 31 | { 32 | self.tableView.reloadData() 33 | } 34 | 35 | override func didReceiveMemoryWarning() { 36 | super.didReceiveMemoryWarning() 37 | // Dispose of any resources that can be recreated. 38 | } 39 | 40 | //#pragma mark - Table view data source 41 | 42 | override func numberOfSectionsInTableView(tableView: UITableView?) -> Int { 43 | // Return the number of sections. 44 | return 1 45 | } 46 | 47 | override func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -> Int { 48 | 49 | // Return the number of rows in the section. 50 | return tableArray.count; 51 | } 52 | 53 | override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool 54 | { 55 | return true; 56 | } 57 | 58 | override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) 59 | { 60 | if(editingStyle == UITableViewCellEditingStyle.Delete) 61 | { 62 | tableArray.removeObjectAtIndex(indexPath.row) 63 | tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade) 64 | tableView.reloadData() 65 | } 66 | } 67 | 68 | 69 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 70 | let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! UITableViewCell 71 | cell.textLabel?.text = tableArray.objectAtIndex(indexPath.row) as! String 72 | return cell 73 | } 74 | 75 | override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) 76 | { 77 | self.showAlert(tableArray.objectAtIndex(indexPath.row) as! NSString, rowToUseInAlert: indexPath.row) 78 | } 79 | 80 | //#pragma mark - UIAlertView delegate methods 81 | 82 | func alertView(alertView: UIAlertView!, didDismissWithButtonIndex buttonIndex: Int) { 83 | NSLog("Did dismiss button: %d", buttonIndex) 84 | } 85 | 86 | // Function to init a UIAlertView and show it 87 | func showAlert(rowTitle:NSString, rowToUseInAlert: Int) { 88 | var alert = UIAlertView() 89 | 90 | alert.delegate = self 91 | alert.title = rowTitle as String 92 | alert.message = "You selected row \(rowToUseInAlert)" 93 | alert.addButtonWithTitle("OK") 94 | 95 | alert.show() 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /SwiftExample/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SwiftExample 4 | // 5 | // Created by Sachin Kesiraju on 6/3/14. 6 | // Copyright (c) 2014 Sachin Kesiraju. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | // Do any additional setup after loading the view, typically from a nib. 16 | self.title = "Swift Example" 17 | } 18 | 19 | override func didReceiveMemoryWarning() { 20 | super.didReceiveMemoryWarning() 21 | // Dispose of any resources that can be recreated. 22 | } 23 | 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /SwiftExample/WebViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // WebViewController.swift 3 | // SwiftExample 4 | // 5 | // Created by Sachin Kesiraju on 6/3/14. 6 | // Copyright (c) 2014 Sachin Kesiraju. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class WebViewController: UIViewController, UIWebViewDelegate { 12 | 13 | @IBOutlet var webView : UIWebView? 14 | 15 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { 16 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 17 | // Custom initialization 18 | } 19 | 20 | required init(coder aDecoder: NSCoder) { 21 | super.init(coder: aDecoder) 22 | } 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | let requestURL = NSURL(string: "http://apple.com") 27 | let request = NSURLRequest(URL: requestURL!) 28 | webView?.loadRequest(request) 29 | } 30 | 31 | func webViewDidStartLoad(webView: UIWebView) { 32 | UIApplication.sharedApplication().networkActivityIndicatorVisible = true 33 | } 34 | 35 | func webViewDidFinishLoad(webView: UIWebView) { 36 | UIApplication.sharedApplication().networkActivityIndicatorVisible = false 37 | } 38 | 39 | override func didReceiveMemoryWarning() { 40 | super.didReceiveMemoryWarning() 41 | // Dispose of any resources that can be recreated. 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /SwiftExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | Sachin.Kesiraju.${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 | -------------------------------------------------------------------------------- /SwiftExampleTests/SwiftExampleTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftExampleTests.swift 3 | // SwiftExampleTests 4 | // 5 | // Created by Sachin Kesiraju on 6/3/14. 6 | // Copyright (c) 2014 Sachin Kesiraju. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class SwiftExampleTests: 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 | --------------------------------------------------------------------------------