├── .gitignore ├── Lesson 1 ├── Lesson 1.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Lesson 1 │ └── main.swift ├── Lesson 2 ├── Lesson 2.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Lesson 2.xcscheme └── Lesson 2 │ └── main.swift ├── Lesson 3 ├── Lesson 3.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Lesson 3 │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ └── MainMenu.xib │ ├── Info.plist │ └── Lesson_3.entitlements ├── Lesson 4 ├── Lesson 4.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Lesson 4 │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ └── MainMenu.xib │ ├── Info.plist │ ├── Lesson_4.entitlements │ ├── Models │ └── SystemIcons.swift │ └── View Controllers │ ├── TableViewController.swift │ └── TableViewController.xib ├── Lesson 5 ├── Lesson 5.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Lesson 5.xcscheme └── Lesson 5 │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── Star.imageset │ │ ├── Contents.json │ │ └── Star.pdf │ └── StarFilled.imageset │ │ ├── Contents.json │ │ └── StarFilled.pdf │ ├── Base.lproj │ └── MainMenu.xib │ ├── Info.plist │ ├── Lesson_5.entitlements │ ├── Model │ └── Chat.swift │ ├── View Controllers │ ├── ChatDetailsViewController.swift │ ├── ChatDetailsViewController.xib │ ├── ChatListViewController.swift │ └── ChatListViewController.xib │ └── Views │ ├── TableCell.swift │ └── Toggle.swift ├── Lesson 6 ├── Lesson 6.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Lesson 6.xcscheme └── Lesson 6 │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ └── MainMenu.xib │ ├── Info.plist │ └── Lesson_6.entitlements ├── Lesson 7 ├── Lesson 7.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Lesson 7.xcscheme └── Lesson 7 │ ├── GameBoard.c │ ├── GameBoard.h │ ├── Lesson 7-Bridging-Header.h │ └── main.swift ├── Lesson 8 ├── Lesson 8.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Lesson 8 │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ └── MainMenu.xib │ ├── Info.plist │ └── Lesson_8.entitlements └── Lesson 9 ├── Lesson 9.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── Lesson 9.xcscheme └── Lesson 9 ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json └── Contents.json ├── Base.lproj └── MainMenu.xib ├── Info.plist ├── Lesson_9.entitlements ├── PictureCollectionViewController.swift ├── PictureCollectionViewController.xib ├── PictureCollectionViewItem.swift └── PictureCollectionViewItem.xib /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | 92 | .DS_Store 93 | -------------------------------------------------------------------------------- /Lesson 1/Lesson 1.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D1C137622EA179F0031548D /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D1C137522EA179F0031548D /* main.swift */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | 1D1C137022EA179F0031548D /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = /usr/share/man/man1/; 18 | dstSubfolderSpec = 0; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 1; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 1D1C137222EA179F0031548D /* Lesson 1 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Lesson 1"; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 1D1C137522EA179F0031548D /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | 1D1C136F22EA179F0031548D /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 2147483647; 34 | files = ( 35 | ); 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXFrameworksBuildPhase section */ 39 | 40 | /* Begin PBXGroup section */ 41 | 1D1C136922EA179F0031548D = { 42 | isa = PBXGroup; 43 | children = ( 44 | 1D1C137422EA179F0031548D /* Lesson 1 */, 45 | 1D1C137322EA179F0031548D /* Products */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | 1D1C137322EA179F0031548D /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 1D1C137222EA179F0031548D /* Lesson 1 */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | 1D1C137422EA179F0031548D /* Lesson 1 */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 1D1C137522EA179F0031548D /* main.swift */, 61 | ); 62 | path = "Lesson 1"; 63 | sourceTree = ""; 64 | }; 65 | /* End PBXGroup section */ 66 | 67 | /* Begin PBXNativeTarget section */ 68 | 1D1C137122EA179F0031548D /* Lesson 1 */ = { 69 | isa = PBXNativeTarget; 70 | buildConfigurationList = 1D1C137922EA179F0031548D /* Build configuration list for PBXNativeTarget "Lesson 1" */; 71 | buildPhases = ( 72 | 1D1C136E22EA179F0031548D /* Sources */, 73 | 1D1C136F22EA179F0031548D /* Frameworks */, 74 | 1D1C137022EA179F0031548D /* CopyFiles */, 75 | ); 76 | buildRules = ( 77 | ); 78 | dependencies = ( 79 | ); 80 | name = "Lesson 1"; 81 | productName = "Lesson 1"; 82 | productReference = 1D1C137222EA179F0031548D /* Lesson 1 */; 83 | productType = "com.apple.product-type.tool"; 84 | }; 85 | /* End PBXNativeTarget section */ 86 | 87 | /* Begin PBXProject section */ 88 | 1D1C136A22EA179F0031548D /* Project object */ = { 89 | isa = PBXProject; 90 | attributes = { 91 | LastSwiftUpdateCheck = 1030; 92 | LastUpgradeCheck = 1030; 93 | ORGANIZATIONNAME = "Lucas Derraugh"; 94 | TargetAttributes = { 95 | 1D1C137122EA179F0031548D = { 96 | CreatedOnToolsVersion = 10.3; 97 | }; 98 | }; 99 | }; 100 | buildConfigurationList = 1D1C136D22EA179F0031548D /* Build configuration list for PBXProject "Lesson 1" */; 101 | compatibilityVersion = "Xcode 9.3"; 102 | developmentRegion = en; 103 | hasScannedForEncodings = 0; 104 | knownRegions = ( 105 | en, 106 | ); 107 | mainGroup = 1D1C136922EA179F0031548D; 108 | productRefGroup = 1D1C137322EA179F0031548D /* Products */; 109 | projectDirPath = ""; 110 | projectRoot = ""; 111 | targets = ( 112 | 1D1C137122EA179F0031548D /* Lesson 1 */, 113 | ); 114 | }; 115 | /* End PBXProject section */ 116 | 117 | /* Begin PBXSourcesBuildPhase section */ 118 | 1D1C136E22EA179F0031548D /* Sources */ = { 119 | isa = PBXSourcesBuildPhase; 120 | buildActionMask = 2147483647; 121 | files = ( 122 | 1D1C137622EA179F0031548D /* main.swift in Sources */, 123 | ); 124 | runOnlyForDeploymentPostprocessing = 0; 125 | }; 126 | /* End PBXSourcesBuildPhase section */ 127 | 128 | /* Begin XCBuildConfiguration section */ 129 | 1D1C137722EA179F0031548D /* Debug */ = { 130 | isa = XCBuildConfiguration; 131 | buildSettings = { 132 | ALWAYS_SEARCH_USER_PATHS = NO; 133 | CLANG_ANALYZER_NONNULL = YES; 134 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 135 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 136 | CLANG_CXX_LIBRARY = "libc++"; 137 | CLANG_ENABLE_MODULES = YES; 138 | CLANG_ENABLE_OBJC_ARC = YES; 139 | CLANG_ENABLE_OBJC_WEAK = YES; 140 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 141 | CLANG_WARN_BOOL_CONVERSION = YES; 142 | CLANG_WARN_COMMA = YES; 143 | CLANG_WARN_CONSTANT_CONVERSION = YES; 144 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 145 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 146 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 147 | CLANG_WARN_EMPTY_BODY = YES; 148 | CLANG_WARN_ENUM_CONVERSION = YES; 149 | CLANG_WARN_INFINITE_RECURSION = YES; 150 | CLANG_WARN_INT_CONVERSION = YES; 151 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 152 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 153 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 154 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 155 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 156 | CLANG_WARN_STRICT_PROTOTYPES = YES; 157 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 158 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 159 | CLANG_WARN_UNREACHABLE_CODE = YES; 160 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 161 | CODE_SIGN_IDENTITY = "Mac Developer"; 162 | COPY_PHASE_STRIP = NO; 163 | DEBUG_INFORMATION_FORMAT = dwarf; 164 | ENABLE_STRICT_OBJC_MSGSEND = YES; 165 | ENABLE_TESTABILITY = YES; 166 | GCC_C_LANGUAGE_STANDARD = gnu11; 167 | GCC_DYNAMIC_NO_PIC = NO; 168 | GCC_NO_COMMON_BLOCKS = YES; 169 | GCC_OPTIMIZATION_LEVEL = 0; 170 | GCC_PREPROCESSOR_DEFINITIONS = ( 171 | "DEBUG=1", 172 | "$(inherited)", 173 | ); 174 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 175 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 176 | GCC_WARN_UNDECLARED_SELECTOR = YES; 177 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 178 | GCC_WARN_UNUSED_FUNCTION = YES; 179 | GCC_WARN_UNUSED_VARIABLE = YES; 180 | MACOSX_DEPLOYMENT_TARGET = 10.14; 181 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 182 | MTL_FAST_MATH = YES; 183 | ONLY_ACTIVE_ARCH = YES; 184 | SDKROOT = macosx; 185 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 186 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 187 | }; 188 | name = Debug; 189 | }; 190 | 1D1C137822EA179F0031548D /* Release */ = { 191 | isa = XCBuildConfiguration; 192 | buildSettings = { 193 | ALWAYS_SEARCH_USER_PATHS = NO; 194 | CLANG_ANALYZER_NONNULL = YES; 195 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 196 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 197 | CLANG_CXX_LIBRARY = "libc++"; 198 | CLANG_ENABLE_MODULES = YES; 199 | CLANG_ENABLE_OBJC_ARC = YES; 200 | CLANG_ENABLE_OBJC_WEAK = YES; 201 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 202 | CLANG_WARN_BOOL_CONVERSION = YES; 203 | CLANG_WARN_COMMA = YES; 204 | CLANG_WARN_CONSTANT_CONVERSION = YES; 205 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 206 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 207 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 208 | CLANG_WARN_EMPTY_BODY = YES; 209 | CLANG_WARN_ENUM_CONVERSION = YES; 210 | CLANG_WARN_INFINITE_RECURSION = YES; 211 | CLANG_WARN_INT_CONVERSION = YES; 212 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 213 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 214 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 215 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 216 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 217 | CLANG_WARN_STRICT_PROTOTYPES = YES; 218 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 219 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 220 | CLANG_WARN_UNREACHABLE_CODE = YES; 221 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 222 | CODE_SIGN_IDENTITY = "Mac Developer"; 223 | COPY_PHASE_STRIP = NO; 224 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 225 | ENABLE_NS_ASSERTIONS = NO; 226 | ENABLE_STRICT_OBJC_MSGSEND = YES; 227 | GCC_C_LANGUAGE_STANDARD = gnu11; 228 | GCC_NO_COMMON_BLOCKS = YES; 229 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 230 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 231 | GCC_WARN_UNDECLARED_SELECTOR = YES; 232 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 233 | GCC_WARN_UNUSED_FUNCTION = YES; 234 | GCC_WARN_UNUSED_VARIABLE = YES; 235 | MACOSX_DEPLOYMENT_TARGET = 10.14; 236 | MTL_ENABLE_DEBUG_INFO = NO; 237 | MTL_FAST_MATH = YES; 238 | SDKROOT = macosx; 239 | SWIFT_COMPILATION_MODE = wholemodule; 240 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 241 | }; 242 | name = Release; 243 | }; 244 | 1D1C137A22EA179F0031548D /* Debug */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | CODE_SIGN_STYLE = Automatic; 248 | DEVELOPMENT_TEAM = FP44AY6HHW; 249 | PRODUCT_NAME = "$(TARGET_NAME)"; 250 | SWIFT_VERSION = 5.0; 251 | }; 252 | name = Debug; 253 | }; 254 | 1D1C137B22EA179F0031548D /* Release */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | CODE_SIGN_STYLE = Automatic; 258 | DEVELOPMENT_TEAM = FP44AY6HHW; 259 | PRODUCT_NAME = "$(TARGET_NAME)"; 260 | SWIFT_VERSION = 5.0; 261 | }; 262 | name = Release; 263 | }; 264 | /* End XCBuildConfiguration section */ 265 | 266 | /* Begin XCConfigurationList section */ 267 | 1D1C136D22EA179F0031548D /* Build configuration list for PBXProject "Lesson 1" */ = { 268 | isa = XCConfigurationList; 269 | buildConfigurations = ( 270 | 1D1C137722EA179F0031548D /* Debug */, 271 | 1D1C137822EA179F0031548D /* Release */, 272 | ); 273 | defaultConfigurationIsVisible = 0; 274 | defaultConfigurationName = Release; 275 | }; 276 | 1D1C137922EA179F0031548D /* Build configuration list for PBXNativeTarget "Lesson 1" */ = { 277 | isa = XCConfigurationList; 278 | buildConfigurations = ( 279 | 1D1C137A22EA179F0031548D /* Debug */, 280 | 1D1C137B22EA179F0031548D /* Release */, 281 | ); 282 | defaultConfigurationIsVisible = 0; 283 | defaultConfigurationName = Release; 284 | }; 285 | /* End XCConfigurationList section */ 286 | }; 287 | rootObject = 1D1C136A22EA179F0031548D /* Project object */; 288 | } 289 | -------------------------------------------------------------------------------- /Lesson 1/Lesson 1.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lesson 1/Lesson 1.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lesson 1/Lesson 1/main.swift: -------------------------------------------------------------------------------- 1 | // 2 | // main.swift 3 | // Lesson 1 4 | // 5 | // Created by Lucas Derraugh on 7/25/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Bar: NSObject { 12 | 13 | override var description: String { 14 | return "Bar Description" 15 | } 16 | 17 | override var debugDescription: String { 18 | return "Bar Debug Description" 19 | } 20 | } 21 | 22 | class Foo: CustomStringConvertible, CustomDebugStringConvertible { 23 | let name = "Lucas" 24 | let age = 25 25 | 26 | var description: String { 27 | return "Foo Description" 28 | } 29 | } 30 | 31 | extension CustomDebugStringConvertible { 32 | var debugDescription: String { 33 | let className = type(of: self) 34 | let address = "\(Unmanaged.passUnretained(self as AnyObject).toOpaque())" 35 | var description = "<\(className): \(address), {" 36 | 37 | let mirror = Mirror(reflecting: self) 38 | description += mirror.children.compactMap { 39 | let (label, value) = $0 40 | guard let propertyName = label else { return nil } 41 | return "\(propertyName): \(value)" 42 | }.joined(separator: ", ") 43 | 44 | description += "}>" 45 | 46 | return description 47 | } 48 | } 49 | 50 | let bar = Bar() 51 | let foo = Foo() 52 | 53 | print(bar) 54 | debugPrint(bar) 55 | 56 | print(foo) 57 | debugPrint(foo) 58 | -------------------------------------------------------------------------------- /Lesson 2/Lesson 2.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D32E46022EFDB3800124627 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D32E45F22EFDB3800124627 /* main.swift */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | 1D32E45A22EFDB3800124627 /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = /usr/share/man/man1/; 18 | dstSubfolderSpec = 0; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 1; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 1D32E45C22EFDB3800124627 /* Lesson 2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Lesson 2"; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 1D32E45F22EFDB3800124627 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | 1D32E45922EFDB3800124627 /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 2147483647; 34 | files = ( 35 | ); 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXFrameworksBuildPhase section */ 39 | 40 | /* Begin PBXGroup section */ 41 | 1D32E45322EFDB3800124627 = { 42 | isa = PBXGroup; 43 | children = ( 44 | 1D32E45E22EFDB3800124627 /* Lesson 2 */, 45 | 1D32E45D22EFDB3800124627 /* Products */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | 1D32E45D22EFDB3800124627 /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 1D32E45C22EFDB3800124627 /* Lesson 2 */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | 1D32E45E22EFDB3800124627 /* Lesson 2 */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 1D32E45F22EFDB3800124627 /* main.swift */, 61 | ); 62 | path = "Lesson 2"; 63 | sourceTree = ""; 64 | }; 65 | /* End PBXGroup section */ 66 | 67 | /* Begin PBXNativeTarget section */ 68 | 1D32E45B22EFDB3800124627 /* Lesson 2 */ = { 69 | isa = PBXNativeTarget; 70 | buildConfigurationList = 1D32E46322EFDB3800124627 /* Build configuration list for PBXNativeTarget "Lesson 2" */; 71 | buildPhases = ( 72 | 1D32E45822EFDB3800124627 /* Sources */, 73 | 1D32E45922EFDB3800124627 /* Frameworks */, 74 | 1D32E45A22EFDB3800124627 /* CopyFiles */, 75 | ); 76 | buildRules = ( 77 | ); 78 | dependencies = ( 79 | ); 80 | name = "Lesson 2"; 81 | productName = "Lesson 2"; 82 | productReference = 1D32E45C22EFDB3800124627 /* Lesson 2 */; 83 | productType = "com.apple.product-type.tool"; 84 | }; 85 | /* End PBXNativeTarget section */ 86 | 87 | /* Begin PBXProject section */ 88 | 1D32E45422EFDB3800124627 /* Project object */ = { 89 | isa = PBXProject; 90 | attributes = { 91 | LastSwiftUpdateCheck = 1030; 92 | LastUpgradeCheck = 1030; 93 | ORGANIZATIONNAME = "Lucas Derraugh"; 94 | TargetAttributes = { 95 | 1D32E45B22EFDB3800124627 = { 96 | CreatedOnToolsVersion = 10.3; 97 | }; 98 | }; 99 | }; 100 | buildConfigurationList = 1D32E45722EFDB3800124627 /* Build configuration list for PBXProject "Lesson 2" */; 101 | compatibilityVersion = "Xcode 9.3"; 102 | developmentRegion = en; 103 | hasScannedForEncodings = 0; 104 | knownRegions = ( 105 | en, 106 | ); 107 | mainGroup = 1D32E45322EFDB3800124627; 108 | productRefGroup = 1D32E45D22EFDB3800124627 /* Products */; 109 | projectDirPath = ""; 110 | projectRoot = ""; 111 | targets = ( 112 | 1D32E45B22EFDB3800124627 /* Lesson 2 */, 113 | ); 114 | }; 115 | /* End PBXProject section */ 116 | 117 | /* Begin PBXSourcesBuildPhase section */ 118 | 1D32E45822EFDB3800124627 /* Sources */ = { 119 | isa = PBXSourcesBuildPhase; 120 | buildActionMask = 2147483647; 121 | files = ( 122 | 1D32E46022EFDB3800124627 /* main.swift in Sources */, 123 | ); 124 | runOnlyForDeploymentPostprocessing = 0; 125 | }; 126 | /* End PBXSourcesBuildPhase section */ 127 | 128 | /* Begin XCBuildConfiguration section */ 129 | 1D32E46122EFDB3800124627 /* Debug */ = { 130 | isa = XCBuildConfiguration; 131 | buildSettings = { 132 | ALWAYS_SEARCH_USER_PATHS = NO; 133 | CLANG_ANALYZER_NONNULL = YES; 134 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 135 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 136 | CLANG_CXX_LIBRARY = "libc++"; 137 | CLANG_ENABLE_MODULES = YES; 138 | CLANG_ENABLE_OBJC_ARC = YES; 139 | CLANG_ENABLE_OBJC_WEAK = YES; 140 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 141 | CLANG_WARN_BOOL_CONVERSION = YES; 142 | CLANG_WARN_COMMA = YES; 143 | CLANG_WARN_CONSTANT_CONVERSION = YES; 144 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 145 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 146 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 147 | CLANG_WARN_EMPTY_BODY = YES; 148 | CLANG_WARN_ENUM_CONVERSION = YES; 149 | CLANG_WARN_INFINITE_RECURSION = YES; 150 | CLANG_WARN_INT_CONVERSION = YES; 151 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 152 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 153 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 154 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 155 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 156 | CLANG_WARN_STRICT_PROTOTYPES = YES; 157 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 158 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 159 | CLANG_WARN_UNREACHABLE_CODE = YES; 160 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 161 | CODE_SIGN_IDENTITY = "Mac Developer"; 162 | COPY_PHASE_STRIP = NO; 163 | DEBUG_INFORMATION_FORMAT = dwarf; 164 | ENABLE_STRICT_OBJC_MSGSEND = YES; 165 | ENABLE_TESTABILITY = YES; 166 | GCC_C_LANGUAGE_STANDARD = gnu11; 167 | GCC_DYNAMIC_NO_PIC = NO; 168 | GCC_NO_COMMON_BLOCKS = YES; 169 | GCC_OPTIMIZATION_LEVEL = 0; 170 | GCC_PREPROCESSOR_DEFINITIONS = ( 171 | "DEBUG=1", 172 | "$(inherited)", 173 | ); 174 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 175 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 176 | GCC_WARN_UNDECLARED_SELECTOR = YES; 177 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 178 | GCC_WARN_UNUSED_FUNCTION = YES; 179 | GCC_WARN_UNUSED_VARIABLE = YES; 180 | MACOSX_DEPLOYMENT_TARGET = 10.14; 181 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 182 | MTL_FAST_MATH = YES; 183 | ONLY_ACTIVE_ARCH = YES; 184 | SDKROOT = macosx; 185 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 186 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 187 | }; 188 | name = Debug; 189 | }; 190 | 1D32E46222EFDB3800124627 /* Release */ = { 191 | isa = XCBuildConfiguration; 192 | buildSettings = { 193 | ALWAYS_SEARCH_USER_PATHS = NO; 194 | CLANG_ANALYZER_NONNULL = YES; 195 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 196 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 197 | CLANG_CXX_LIBRARY = "libc++"; 198 | CLANG_ENABLE_MODULES = YES; 199 | CLANG_ENABLE_OBJC_ARC = YES; 200 | CLANG_ENABLE_OBJC_WEAK = YES; 201 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 202 | CLANG_WARN_BOOL_CONVERSION = YES; 203 | CLANG_WARN_COMMA = YES; 204 | CLANG_WARN_CONSTANT_CONVERSION = YES; 205 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 206 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 207 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 208 | CLANG_WARN_EMPTY_BODY = YES; 209 | CLANG_WARN_ENUM_CONVERSION = YES; 210 | CLANG_WARN_INFINITE_RECURSION = YES; 211 | CLANG_WARN_INT_CONVERSION = YES; 212 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 213 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 214 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 215 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 216 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 217 | CLANG_WARN_STRICT_PROTOTYPES = YES; 218 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 219 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 220 | CLANG_WARN_UNREACHABLE_CODE = YES; 221 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 222 | CODE_SIGN_IDENTITY = "Mac Developer"; 223 | COPY_PHASE_STRIP = NO; 224 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 225 | ENABLE_NS_ASSERTIONS = NO; 226 | ENABLE_STRICT_OBJC_MSGSEND = YES; 227 | GCC_C_LANGUAGE_STANDARD = gnu11; 228 | GCC_NO_COMMON_BLOCKS = YES; 229 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 230 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 231 | GCC_WARN_UNDECLARED_SELECTOR = YES; 232 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 233 | GCC_WARN_UNUSED_FUNCTION = YES; 234 | GCC_WARN_UNUSED_VARIABLE = YES; 235 | MACOSX_DEPLOYMENT_TARGET = 10.14; 236 | MTL_ENABLE_DEBUG_INFO = NO; 237 | MTL_FAST_MATH = YES; 238 | SDKROOT = macosx; 239 | SWIFT_COMPILATION_MODE = wholemodule; 240 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 241 | }; 242 | name = Release; 243 | }; 244 | 1D32E46422EFDB3800124627 /* Debug */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | CODE_SIGN_STYLE = Automatic; 248 | DEVELOPMENT_TEAM = FP44AY6HHW; 249 | PRODUCT_NAME = "$(TARGET_NAME)"; 250 | SWIFT_VERSION = 5.0; 251 | }; 252 | name = Debug; 253 | }; 254 | 1D32E46522EFDB3800124627 /* Release */ = { 255 | isa = XCBuildConfiguration; 256 | buildSettings = { 257 | CODE_SIGN_STYLE = Automatic; 258 | DEVELOPMENT_TEAM = FP44AY6HHW; 259 | PRODUCT_NAME = "$(TARGET_NAME)"; 260 | SWIFT_VERSION = 5.0; 261 | }; 262 | name = Release; 263 | }; 264 | /* End XCBuildConfiguration section */ 265 | 266 | /* Begin XCConfigurationList section */ 267 | 1D32E45722EFDB3800124627 /* Build configuration list for PBXProject "Lesson 2" */ = { 268 | isa = XCConfigurationList; 269 | buildConfigurations = ( 270 | 1D32E46122EFDB3800124627 /* Debug */, 271 | 1D32E46222EFDB3800124627 /* Release */, 272 | ); 273 | defaultConfigurationIsVisible = 0; 274 | defaultConfigurationName = Release; 275 | }; 276 | 1D32E46322EFDB3800124627 /* Build configuration list for PBXNativeTarget "Lesson 2" */ = { 277 | isa = XCConfigurationList; 278 | buildConfigurations = ( 279 | 1D32E46422EFDB3800124627 /* Debug */, 280 | 1D32E46522EFDB3800124627 /* Release */, 281 | ); 282 | defaultConfigurationIsVisible = 0; 283 | defaultConfigurationName = Release; 284 | }; 285 | /* End XCConfigurationList section */ 286 | }; 287 | rootObject = 1D32E45422EFDB3800124627 /* Project object */; 288 | } 289 | -------------------------------------------------------------------------------- /Lesson 2/Lesson 2.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lesson 2/Lesson 2.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lesson 2/Lesson 2.xcodeproj/xcshareddata/xcschemes/Lesson 2.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Lesson 2/Lesson 2/main.swift: -------------------------------------------------------------------------------- 1 | // 2 | // main.swift 3 | // Lesson 2 4 | // 5 | // Created by Lucas Derraugh on 7/29/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Person: CustomStringConvertible { 12 | var name: String 13 | let age: Int 14 | 15 | init(name: String, age: Int) { 16 | self.name = name 17 | self.age = age 18 | } 19 | 20 | var description: String { 21 | return "\(name): \(age)" 22 | } 23 | } 24 | 25 | let person1 = Person(name: "Lucas", age: 25) 26 | let person2 = Person(name: "Laura", age: 28) 27 | let person3 = Person(name: "Lee", age: 30) 28 | 29 | let people = [person1, person2, person3] 30 | 31 | for p in people { 32 | print(p) 33 | } 34 | 35 | let age = 60 36 | 37 | func name() { 38 | let myAge = 20 39 | print(myAge) 40 | } 41 | 42 | name() 43 | print(age) 44 | 45 | var i = 0 46 | while i < 4 { 47 | i += 1 48 | print(i) 49 | } 50 | -------------------------------------------------------------------------------- /Lesson 3/Lesson 3.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D7FF1F622F9DF0A00C8F379 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D7FF1F522F9DF0A00C8F379 /* AppDelegate.swift */; }; 11 | 1D7FF1F822F9DF0A00C8F379 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1D7FF1F722F9DF0A00C8F379 /* Assets.xcassets */; }; 12 | 1D7FF1FB22F9DF0A00C8F379 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D7FF1F922F9DF0A00C8F379 /* MainMenu.xib */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXFileReference section */ 16 | 1D7FF1F222F9DF0A00C8F379 /* Lesson 3.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Lesson 3.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 17 | 1D7FF1F522F9DF0A00C8F379 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 18 | 1D7FF1F722F9DF0A00C8F379 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 19 | 1D7FF1FA22F9DF0A00C8F379 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 20 | 1D7FF1FC22F9DF0A00C8F379 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 21 | 1D7FF1FD22F9DF0A00C8F379 /* Lesson_3.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Lesson_3.entitlements; sourceTree = ""; }; 22 | /* End PBXFileReference section */ 23 | 24 | /* Begin PBXFrameworksBuildPhase section */ 25 | 1D7FF1EF22F9DF0A00C8F379 /* Frameworks */ = { 26 | isa = PBXFrameworksBuildPhase; 27 | buildActionMask = 2147483647; 28 | files = ( 29 | ); 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | /* End PBXFrameworksBuildPhase section */ 33 | 34 | /* Begin PBXGroup section */ 35 | 1D7FF1E922F9DF0A00C8F379 = { 36 | isa = PBXGroup; 37 | children = ( 38 | 1D7FF1F422F9DF0A00C8F379 /* Lesson 3 */, 39 | 1D7FF1F322F9DF0A00C8F379 /* Products */, 40 | ); 41 | sourceTree = ""; 42 | }; 43 | 1D7FF1F322F9DF0A00C8F379 /* Products */ = { 44 | isa = PBXGroup; 45 | children = ( 46 | 1D7FF1F222F9DF0A00C8F379 /* Lesson 3.app */, 47 | ); 48 | name = Products; 49 | sourceTree = ""; 50 | }; 51 | 1D7FF1F422F9DF0A00C8F379 /* Lesson 3 */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | 1D7FF1F522F9DF0A00C8F379 /* AppDelegate.swift */, 55 | 1D7FF1F722F9DF0A00C8F379 /* Assets.xcassets */, 56 | 1D7FF1F922F9DF0A00C8F379 /* MainMenu.xib */, 57 | 1D7FF1FC22F9DF0A00C8F379 /* Info.plist */, 58 | 1D7FF1FD22F9DF0A00C8F379 /* Lesson_3.entitlements */, 59 | ); 60 | path = "Lesson 3"; 61 | sourceTree = ""; 62 | }; 63 | /* End PBXGroup section */ 64 | 65 | /* Begin PBXNativeTarget section */ 66 | 1D7FF1F122F9DF0A00C8F379 /* Lesson 3 */ = { 67 | isa = PBXNativeTarget; 68 | buildConfigurationList = 1D7FF20022F9DF0A00C8F379 /* Build configuration list for PBXNativeTarget "Lesson 3" */; 69 | buildPhases = ( 70 | 1D7FF1EE22F9DF0A00C8F379 /* Sources */, 71 | 1D7FF1EF22F9DF0A00C8F379 /* Frameworks */, 72 | 1D7FF1F022F9DF0A00C8F379 /* Resources */, 73 | ); 74 | buildRules = ( 75 | ); 76 | dependencies = ( 77 | ); 78 | name = "Lesson 3"; 79 | productName = "Lesson 3"; 80 | productReference = 1D7FF1F222F9DF0A00C8F379 /* Lesson 3.app */; 81 | productType = "com.apple.product-type.application"; 82 | }; 83 | /* End PBXNativeTarget section */ 84 | 85 | /* Begin PBXProject section */ 86 | 1D7FF1EA22F9DF0A00C8F379 /* Project object */ = { 87 | isa = PBXProject; 88 | attributes = { 89 | LastSwiftUpdateCheck = 1030; 90 | LastUpgradeCheck = 1030; 91 | ORGANIZATIONNAME = "Lucas Derraugh"; 92 | TargetAttributes = { 93 | 1D7FF1F122F9DF0A00C8F379 = { 94 | CreatedOnToolsVersion = 10.3; 95 | }; 96 | }; 97 | }; 98 | buildConfigurationList = 1D7FF1ED22F9DF0A00C8F379 /* Build configuration list for PBXProject "Lesson 3" */; 99 | compatibilityVersion = "Xcode 9.3"; 100 | developmentRegion = en; 101 | hasScannedForEncodings = 0; 102 | knownRegions = ( 103 | en, 104 | Base, 105 | ); 106 | mainGroup = 1D7FF1E922F9DF0A00C8F379; 107 | productRefGroup = 1D7FF1F322F9DF0A00C8F379 /* Products */; 108 | projectDirPath = ""; 109 | projectRoot = ""; 110 | targets = ( 111 | 1D7FF1F122F9DF0A00C8F379 /* Lesson 3 */, 112 | ); 113 | }; 114 | /* End PBXProject section */ 115 | 116 | /* Begin PBXResourcesBuildPhase section */ 117 | 1D7FF1F022F9DF0A00C8F379 /* Resources */ = { 118 | isa = PBXResourcesBuildPhase; 119 | buildActionMask = 2147483647; 120 | files = ( 121 | 1D7FF1F822F9DF0A00C8F379 /* Assets.xcassets in Resources */, 122 | 1D7FF1FB22F9DF0A00C8F379 /* MainMenu.xib in Resources */, 123 | ); 124 | runOnlyForDeploymentPostprocessing = 0; 125 | }; 126 | /* End PBXResourcesBuildPhase section */ 127 | 128 | /* Begin PBXSourcesBuildPhase section */ 129 | 1D7FF1EE22F9DF0A00C8F379 /* Sources */ = { 130 | isa = PBXSourcesBuildPhase; 131 | buildActionMask = 2147483647; 132 | files = ( 133 | 1D7FF1F622F9DF0A00C8F379 /* AppDelegate.swift in Sources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXSourcesBuildPhase section */ 138 | 139 | /* Begin PBXVariantGroup section */ 140 | 1D7FF1F922F9DF0A00C8F379 /* MainMenu.xib */ = { 141 | isa = PBXVariantGroup; 142 | children = ( 143 | 1D7FF1FA22F9DF0A00C8F379 /* Base */, 144 | ); 145 | name = MainMenu.xib; 146 | sourceTree = ""; 147 | }; 148 | /* End PBXVariantGroup section */ 149 | 150 | /* Begin XCBuildConfiguration section */ 151 | 1D7FF1FE22F9DF0A00C8F379 /* Debug */ = { 152 | isa = XCBuildConfiguration; 153 | buildSettings = { 154 | ALWAYS_SEARCH_USER_PATHS = NO; 155 | CLANG_ANALYZER_NONNULL = YES; 156 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 157 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 158 | CLANG_CXX_LIBRARY = "libc++"; 159 | CLANG_ENABLE_MODULES = YES; 160 | CLANG_ENABLE_OBJC_ARC = YES; 161 | CLANG_ENABLE_OBJC_WEAK = YES; 162 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 163 | CLANG_WARN_BOOL_CONVERSION = YES; 164 | CLANG_WARN_COMMA = YES; 165 | CLANG_WARN_CONSTANT_CONVERSION = YES; 166 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 167 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 168 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 169 | CLANG_WARN_EMPTY_BODY = YES; 170 | CLANG_WARN_ENUM_CONVERSION = YES; 171 | CLANG_WARN_INFINITE_RECURSION = YES; 172 | CLANG_WARN_INT_CONVERSION = YES; 173 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 174 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 175 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 176 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 177 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 178 | CLANG_WARN_STRICT_PROTOTYPES = YES; 179 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 180 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 181 | CLANG_WARN_UNREACHABLE_CODE = YES; 182 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 183 | CODE_SIGN_IDENTITY = "Mac Developer"; 184 | COPY_PHASE_STRIP = NO; 185 | DEBUG_INFORMATION_FORMAT = dwarf; 186 | ENABLE_STRICT_OBJC_MSGSEND = YES; 187 | ENABLE_TESTABILITY = YES; 188 | GCC_C_LANGUAGE_STANDARD = gnu11; 189 | GCC_DYNAMIC_NO_PIC = NO; 190 | GCC_NO_COMMON_BLOCKS = YES; 191 | GCC_OPTIMIZATION_LEVEL = 0; 192 | GCC_PREPROCESSOR_DEFINITIONS = ( 193 | "DEBUG=1", 194 | "$(inherited)", 195 | ); 196 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 197 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 198 | GCC_WARN_UNDECLARED_SELECTOR = YES; 199 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 200 | GCC_WARN_UNUSED_FUNCTION = YES; 201 | GCC_WARN_UNUSED_VARIABLE = YES; 202 | MACOSX_DEPLOYMENT_TARGET = 10.14; 203 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 204 | MTL_FAST_MATH = YES; 205 | ONLY_ACTIVE_ARCH = YES; 206 | SDKROOT = macosx; 207 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 208 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 209 | }; 210 | name = Debug; 211 | }; 212 | 1D7FF1FF22F9DF0A00C8F379 /* Release */ = { 213 | isa = XCBuildConfiguration; 214 | buildSettings = { 215 | ALWAYS_SEARCH_USER_PATHS = NO; 216 | CLANG_ANALYZER_NONNULL = YES; 217 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 218 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 219 | CLANG_CXX_LIBRARY = "libc++"; 220 | CLANG_ENABLE_MODULES = YES; 221 | CLANG_ENABLE_OBJC_ARC = YES; 222 | CLANG_ENABLE_OBJC_WEAK = YES; 223 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 224 | CLANG_WARN_BOOL_CONVERSION = YES; 225 | CLANG_WARN_COMMA = YES; 226 | CLANG_WARN_CONSTANT_CONVERSION = YES; 227 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 228 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 229 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 230 | CLANG_WARN_EMPTY_BODY = YES; 231 | CLANG_WARN_ENUM_CONVERSION = YES; 232 | CLANG_WARN_INFINITE_RECURSION = YES; 233 | CLANG_WARN_INT_CONVERSION = YES; 234 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 235 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 236 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 237 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 238 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 239 | CLANG_WARN_STRICT_PROTOTYPES = YES; 240 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 241 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 242 | CLANG_WARN_UNREACHABLE_CODE = YES; 243 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 244 | CODE_SIGN_IDENTITY = "Mac Developer"; 245 | COPY_PHASE_STRIP = NO; 246 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 247 | ENABLE_NS_ASSERTIONS = NO; 248 | ENABLE_STRICT_OBJC_MSGSEND = YES; 249 | GCC_C_LANGUAGE_STANDARD = gnu11; 250 | GCC_NO_COMMON_BLOCKS = YES; 251 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 252 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 253 | GCC_WARN_UNDECLARED_SELECTOR = YES; 254 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 255 | GCC_WARN_UNUSED_FUNCTION = YES; 256 | GCC_WARN_UNUSED_VARIABLE = YES; 257 | MACOSX_DEPLOYMENT_TARGET = 10.14; 258 | MTL_ENABLE_DEBUG_INFO = NO; 259 | MTL_FAST_MATH = YES; 260 | SDKROOT = macosx; 261 | SWIFT_COMPILATION_MODE = wholemodule; 262 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 263 | }; 264 | name = Release; 265 | }; 266 | 1D7FF20122F9DF0A00C8F379 /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 270 | CODE_SIGN_ENTITLEMENTS = "Lesson 3/Lesson_3.entitlements"; 271 | CODE_SIGN_STYLE = Automatic; 272 | COMBINE_HIDPI_IMAGES = YES; 273 | DEVELOPMENT_TEAM = FP44AY6HHW; 274 | INFOPLIST_FILE = "Lesson 3/Info.plist"; 275 | LD_RUNPATH_SEARCH_PATHS = ( 276 | "$(inherited)", 277 | "@executable_path/../Frameworks", 278 | ); 279 | PRODUCT_BUNDLE_IDENTIFIER = "com.lucasderraugh.Lesson-3"; 280 | PRODUCT_NAME = "$(TARGET_NAME)"; 281 | SWIFT_VERSION = 5.0; 282 | }; 283 | name = Debug; 284 | }; 285 | 1D7FF20222F9DF0A00C8F379 /* Release */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CODE_SIGN_ENTITLEMENTS = "Lesson 3/Lesson_3.entitlements"; 290 | CODE_SIGN_STYLE = Automatic; 291 | COMBINE_HIDPI_IMAGES = YES; 292 | DEVELOPMENT_TEAM = FP44AY6HHW; 293 | INFOPLIST_FILE = "Lesson 3/Info.plist"; 294 | LD_RUNPATH_SEARCH_PATHS = ( 295 | "$(inherited)", 296 | "@executable_path/../Frameworks", 297 | ); 298 | PRODUCT_BUNDLE_IDENTIFIER = "com.lucasderraugh.Lesson-3"; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | SWIFT_VERSION = 5.0; 301 | }; 302 | name = Release; 303 | }; 304 | /* End XCBuildConfiguration section */ 305 | 306 | /* Begin XCConfigurationList section */ 307 | 1D7FF1ED22F9DF0A00C8F379 /* Build configuration list for PBXProject "Lesson 3" */ = { 308 | isa = XCConfigurationList; 309 | buildConfigurations = ( 310 | 1D7FF1FE22F9DF0A00C8F379 /* Debug */, 311 | 1D7FF1FF22F9DF0A00C8F379 /* Release */, 312 | ); 313 | defaultConfigurationIsVisible = 0; 314 | defaultConfigurationName = Release; 315 | }; 316 | 1D7FF20022F9DF0A00C8F379 /* Build configuration list for PBXNativeTarget "Lesson 3" */ = { 317 | isa = XCConfigurationList; 318 | buildConfigurations = ( 319 | 1D7FF20122F9DF0A00C8F379 /* Debug */, 320 | 1D7FF20222F9DF0A00C8F379 /* Release */, 321 | ); 322 | defaultConfigurationIsVisible = 0; 323 | defaultConfigurationName = Release; 324 | }; 325 | /* End XCConfigurationList section */ 326 | }; 327 | rootObject = 1D7FF1EA22F9DF0A00C8F379 /* Project object */; 328 | } 329 | -------------------------------------------------------------------------------- /Lesson 3/Lesson 3.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lesson 3/Lesson 3.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lesson 3/Lesson 3/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Lesson 3 4 | // 5 | // Created by Lucas Derraugh on 8/6/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | @IBOutlet weak var window: NSWindow! 15 | @IBOutlet weak var label: NSTextField! 16 | var clickCounter = 0 17 | 18 | func applicationDidFinishLaunching(_ aNotification: Notification) { 19 | print("applicationDidFinishLaunching") 20 | } 21 | 22 | func applicationWillTerminate(_ aNotification: Notification) { 23 | print("applicationWillTerminate") 24 | } 25 | 26 | @IBAction func buttonPressed(_ sender: NSButton) { 27 | label.stringValue = labelText() 28 | } 29 | 30 | func labelText() -> String { 31 | clickCounter += 1 32 | return "Number of Clicks: \(clickCounter)" 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Lesson 3/Lesson 3/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Lesson 3/Lesson 3/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Lesson 3/Lesson 3/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2019 Lucas Derraugh. All rights reserved. 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /Lesson 3/Lesson 3/Lesson_3.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Lesson 4/Lesson 4.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D29B3042305126100CC06EF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D29B3032305126100CC06EF /* AppDelegate.swift */; }; 11 | 1D29B3062305126200CC06EF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1D29B3052305126200CC06EF /* Assets.xcassets */; }; 12 | 1D29B3092305126200CC06EF /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D29B3072305126200CC06EF /* MainMenu.xib */; }; 13 | 1D29B313230512EC00CC06EF /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D29B311230512EC00CC06EF /* TableViewController.swift */; }; 14 | 1D29B314230512EC00CC06EF /* TableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D29B312230512EC00CC06EF /* TableViewController.xib */; }; 15 | 1D492B76230516B2006686A1 /* SystemIcons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D492B75230516B2006686A1 /* SystemIcons.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 1D29B3002305126100CC06EF /* Lesson 4.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Lesson 4.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 1D29B3032305126100CC06EF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | 1D29B3052305126200CC06EF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 22 | 1D29B3082305126200CC06EF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 23 | 1D29B30A2305126200CC06EF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 24 | 1D29B30B2305126200CC06EF /* Lesson_4.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Lesson_4.entitlements; sourceTree = ""; }; 25 | 1D29B311230512EC00CC06EF /* TableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; }; 26 | 1D29B312230512EC00CC06EF /* TableViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TableViewController.xib; sourceTree = ""; }; 27 | 1D492B75230516B2006686A1 /* SystemIcons.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemIcons.swift; sourceTree = ""; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | 1D29B2FD2305126100CC06EF /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 2147483647; 34 | files = ( 35 | ); 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXFrameworksBuildPhase section */ 39 | 40 | /* Begin PBXGroup section */ 41 | 1D29B2F72305126100CC06EF = { 42 | isa = PBXGroup; 43 | children = ( 44 | 1D29B3022305126100CC06EF /* Lesson 4 */, 45 | 1D29B3012305126100CC06EF /* Products */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | 1D29B3012305126100CC06EF /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 1D29B3002305126100CC06EF /* Lesson 4.app */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | 1D29B3022305126100CC06EF /* Lesson 4 */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 1D29B3032305126100CC06EF /* AppDelegate.swift */, 61 | 1D492B7923051735006686A1 /* View Controllers */, 62 | 1D492B782305172B006686A1 /* Models */, 63 | 1D29B3052305126200CC06EF /* Assets.xcassets */, 64 | 1D29B3072305126200CC06EF /* MainMenu.xib */, 65 | 1D29B30A2305126200CC06EF /* Info.plist */, 66 | 1D29B30B2305126200CC06EF /* Lesson_4.entitlements */, 67 | ); 68 | path = "Lesson 4"; 69 | sourceTree = ""; 70 | }; 71 | 1D492B782305172B006686A1 /* Models */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 1D492B75230516B2006686A1 /* SystemIcons.swift */, 75 | ); 76 | path = Models; 77 | sourceTree = ""; 78 | }; 79 | 1D492B7923051735006686A1 /* View Controllers */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 1D29B311230512EC00CC06EF /* TableViewController.swift */, 83 | 1D29B312230512EC00CC06EF /* TableViewController.xib */, 84 | ); 85 | path = "View Controllers"; 86 | sourceTree = ""; 87 | }; 88 | /* End PBXGroup section */ 89 | 90 | /* Begin PBXNativeTarget section */ 91 | 1D29B2FF2305126100CC06EF /* Lesson 4 */ = { 92 | isa = PBXNativeTarget; 93 | buildConfigurationList = 1D29B30E2305126200CC06EF /* Build configuration list for PBXNativeTarget "Lesson 4" */; 94 | buildPhases = ( 95 | 1D29B2FC2305126100CC06EF /* Sources */, 96 | 1D29B2FD2305126100CC06EF /* Frameworks */, 97 | 1D29B2FE2305126100CC06EF /* Resources */, 98 | ); 99 | buildRules = ( 100 | ); 101 | dependencies = ( 102 | ); 103 | name = "Lesson 4"; 104 | productName = "Lesson 4"; 105 | productReference = 1D29B3002305126100CC06EF /* Lesson 4.app */; 106 | productType = "com.apple.product-type.application"; 107 | }; 108 | /* End PBXNativeTarget section */ 109 | 110 | /* Begin PBXProject section */ 111 | 1D29B2F82305126100CC06EF /* Project object */ = { 112 | isa = PBXProject; 113 | attributes = { 114 | LastSwiftUpdateCheck = 1030; 115 | LastUpgradeCheck = 1030; 116 | ORGANIZATIONNAME = "Lucas Derraugh"; 117 | TargetAttributes = { 118 | 1D29B2FF2305126100CC06EF = { 119 | CreatedOnToolsVersion = 10.3; 120 | }; 121 | }; 122 | }; 123 | buildConfigurationList = 1D29B2FB2305126100CC06EF /* Build configuration list for PBXProject "Lesson 4" */; 124 | compatibilityVersion = "Xcode 9.3"; 125 | developmentRegion = en; 126 | hasScannedForEncodings = 0; 127 | knownRegions = ( 128 | en, 129 | Base, 130 | ); 131 | mainGroup = 1D29B2F72305126100CC06EF; 132 | productRefGroup = 1D29B3012305126100CC06EF /* Products */; 133 | projectDirPath = ""; 134 | projectRoot = ""; 135 | targets = ( 136 | 1D29B2FF2305126100CC06EF /* Lesson 4 */, 137 | ); 138 | }; 139 | /* End PBXProject section */ 140 | 141 | /* Begin PBXResourcesBuildPhase section */ 142 | 1D29B2FE2305126100CC06EF /* Resources */ = { 143 | isa = PBXResourcesBuildPhase; 144 | buildActionMask = 2147483647; 145 | files = ( 146 | 1D29B314230512EC00CC06EF /* TableViewController.xib in Resources */, 147 | 1D29B3062305126200CC06EF /* Assets.xcassets in Resources */, 148 | 1D29B3092305126200CC06EF /* MainMenu.xib in Resources */, 149 | ); 150 | runOnlyForDeploymentPostprocessing = 0; 151 | }; 152 | /* End PBXResourcesBuildPhase section */ 153 | 154 | /* Begin PBXSourcesBuildPhase section */ 155 | 1D29B2FC2305126100CC06EF /* Sources */ = { 156 | isa = PBXSourcesBuildPhase; 157 | buildActionMask = 2147483647; 158 | files = ( 159 | 1D29B3042305126100CC06EF /* AppDelegate.swift in Sources */, 160 | 1D492B76230516B2006686A1 /* SystemIcons.swift in Sources */, 161 | 1D29B313230512EC00CC06EF /* TableViewController.swift in Sources */, 162 | ); 163 | runOnlyForDeploymentPostprocessing = 0; 164 | }; 165 | /* End PBXSourcesBuildPhase section */ 166 | 167 | /* Begin PBXVariantGroup section */ 168 | 1D29B3072305126200CC06EF /* MainMenu.xib */ = { 169 | isa = PBXVariantGroup; 170 | children = ( 171 | 1D29B3082305126200CC06EF /* Base */, 172 | ); 173 | name = MainMenu.xib; 174 | sourceTree = ""; 175 | }; 176 | /* End PBXVariantGroup section */ 177 | 178 | /* Begin XCBuildConfiguration section */ 179 | 1D29B30C2305126200CC06EF /* Debug */ = { 180 | isa = XCBuildConfiguration; 181 | buildSettings = { 182 | ALWAYS_SEARCH_USER_PATHS = NO; 183 | CLANG_ANALYZER_NONNULL = YES; 184 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 185 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 186 | CLANG_CXX_LIBRARY = "libc++"; 187 | CLANG_ENABLE_MODULES = YES; 188 | CLANG_ENABLE_OBJC_ARC = YES; 189 | CLANG_ENABLE_OBJC_WEAK = YES; 190 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 191 | CLANG_WARN_BOOL_CONVERSION = YES; 192 | CLANG_WARN_COMMA = YES; 193 | CLANG_WARN_CONSTANT_CONVERSION = YES; 194 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 195 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 196 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 197 | CLANG_WARN_EMPTY_BODY = YES; 198 | CLANG_WARN_ENUM_CONVERSION = YES; 199 | CLANG_WARN_INFINITE_RECURSION = YES; 200 | CLANG_WARN_INT_CONVERSION = YES; 201 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 202 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 203 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 204 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 205 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 206 | CLANG_WARN_STRICT_PROTOTYPES = YES; 207 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 208 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 209 | CLANG_WARN_UNREACHABLE_CODE = YES; 210 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 211 | CODE_SIGN_IDENTITY = "Mac Developer"; 212 | COPY_PHASE_STRIP = NO; 213 | DEBUG_INFORMATION_FORMAT = dwarf; 214 | ENABLE_STRICT_OBJC_MSGSEND = YES; 215 | ENABLE_TESTABILITY = YES; 216 | GCC_C_LANGUAGE_STANDARD = gnu11; 217 | GCC_DYNAMIC_NO_PIC = NO; 218 | GCC_NO_COMMON_BLOCKS = YES; 219 | GCC_OPTIMIZATION_LEVEL = 0; 220 | GCC_PREPROCESSOR_DEFINITIONS = ( 221 | "DEBUG=1", 222 | "$(inherited)", 223 | ); 224 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 225 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 226 | GCC_WARN_UNDECLARED_SELECTOR = YES; 227 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 228 | GCC_WARN_UNUSED_FUNCTION = YES; 229 | GCC_WARN_UNUSED_VARIABLE = YES; 230 | MACOSX_DEPLOYMENT_TARGET = 10.14; 231 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 232 | MTL_FAST_MATH = YES; 233 | ONLY_ACTIVE_ARCH = YES; 234 | SDKROOT = macosx; 235 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 236 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 237 | }; 238 | name = Debug; 239 | }; 240 | 1D29B30D2305126200CC06EF /* Release */ = { 241 | isa = XCBuildConfiguration; 242 | buildSettings = { 243 | ALWAYS_SEARCH_USER_PATHS = NO; 244 | CLANG_ANALYZER_NONNULL = YES; 245 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 246 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 247 | CLANG_CXX_LIBRARY = "libc++"; 248 | CLANG_ENABLE_MODULES = YES; 249 | CLANG_ENABLE_OBJC_ARC = YES; 250 | CLANG_ENABLE_OBJC_WEAK = YES; 251 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 252 | CLANG_WARN_BOOL_CONVERSION = YES; 253 | CLANG_WARN_COMMA = YES; 254 | CLANG_WARN_CONSTANT_CONVERSION = YES; 255 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 256 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 257 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 258 | CLANG_WARN_EMPTY_BODY = YES; 259 | CLANG_WARN_ENUM_CONVERSION = YES; 260 | CLANG_WARN_INFINITE_RECURSION = YES; 261 | CLANG_WARN_INT_CONVERSION = YES; 262 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 263 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 264 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 265 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 266 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 267 | CLANG_WARN_STRICT_PROTOTYPES = YES; 268 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 269 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 270 | CLANG_WARN_UNREACHABLE_CODE = YES; 271 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 272 | CODE_SIGN_IDENTITY = "Mac Developer"; 273 | COPY_PHASE_STRIP = NO; 274 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 275 | ENABLE_NS_ASSERTIONS = NO; 276 | ENABLE_STRICT_OBJC_MSGSEND = YES; 277 | GCC_C_LANGUAGE_STANDARD = gnu11; 278 | GCC_NO_COMMON_BLOCKS = YES; 279 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 280 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 281 | GCC_WARN_UNDECLARED_SELECTOR = YES; 282 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 283 | GCC_WARN_UNUSED_FUNCTION = YES; 284 | GCC_WARN_UNUSED_VARIABLE = YES; 285 | MACOSX_DEPLOYMENT_TARGET = 10.14; 286 | MTL_ENABLE_DEBUG_INFO = NO; 287 | MTL_FAST_MATH = YES; 288 | SDKROOT = macosx; 289 | SWIFT_COMPILATION_MODE = wholemodule; 290 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 291 | }; 292 | name = Release; 293 | }; 294 | 1D29B30F2305126200CC06EF /* Debug */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | CODE_SIGN_ENTITLEMENTS = "Lesson 4/Lesson_4.entitlements"; 299 | CODE_SIGN_STYLE = Automatic; 300 | COMBINE_HIDPI_IMAGES = YES; 301 | DEVELOPMENT_TEAM = FP44AY6HHW; 302 | INFOPLIST_FILE = "Lesson 4/Info.plist"; 303 | LD_RUNPATH_SEARCH_PATHS = ( 304 | "$(inherited)", 305 | "@executable_path/../Frameworks", 306 | ); 307 | PRODUCT_BUNDLE_IDENTIFIER = "com.lucasderraugh.Lesson-4"; 308 | PRODUCT_NAME = "$(TARGET_NAME)"; 309 | SWIFT_VERSION = 5.0; 310 | }; 311 | name = Debug; 312 | }; 313 | 1D29B3102305126200CC06EF /* Release */ = { 314 | isa = XCBuildConfiguration; 315 | buildSettings = { 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 317 | CODE_SIGN_ENTITLEMENTS = "Lesson 4/Lesson_4.entitlements"; 318 | CODE_SIGN_STYLE = Automatic; 319 | COMBINE_HIDPI_IMAGES = YES; 320 | DEVELOPMENT_TEAM = FP44AY6HHW; 321 | INFOPLIST_FILE = "Lesson 4/Info.plist"; 322 | LD_RUNPATH_SEARCH_PATHS = ( 323 | "$(inherited)", 324 | "@executable_path/../Frameworks", 325 | ); 326 | PRODUCT_BUNDLE_IDENTIFIER = "com.lucasderraugh.Lesson-4"; 327 | PRODUCT_NAME = "$(TARGET_NAME)"; 328 | SWIFT_VERSION = 5.0; 329 | }; 330 | name = Release; 331 | }; 332 | /* End XCBuildConfiguration section */ 333 | 334 | /* Begin XCConfigurationList section */ 335 | 1D29B2FB2305126100CC06EF /* Build configuration list for PBXProject "Lesson 4" */ = { 336 | isa = XCConfigurationList; 337 | buildConfigurations = ( 338 | 1D29B30C2305126200CC06EF /* Debug */, 339 | 1D29B30D2305126200CC06EF /* Release */, 340 | ); 341 | defaultConfigurationIsVisible = 0; 342 | defaultConfigurationName = Release; 343 | }; 344 | 1D29B30E2305126200CC06EF /* Build configuration list for PBXNativeTarget "Lesson 4" */ = { 345 | isa = XCConfigurationList; 346 | buildConfigurations = ( 347 | 1D29B30F2305126200CC06EF /* Debug */, 348 | 1D29B3102305126200CC06EF /* Release */, 349 | ); 350 | defaultConfigurationIsVisible = 0; 351 | defaultConfigurationName = Release; 352 | }; 353 | /* End XCConfigurationList section */ 354 | }; 355 | rootObject = 1D29B2F82305126100CC06EF /* Project object */; 356 | } 357 | -------------------------------------------------------------------------------- /Lesson 4/Lesson 4.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lesson 4/Lesson 4.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lesson 4/Lesson 4/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Lesson 4 4 | // 5 | // Created by Lucas Derraugh on 8/14/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | @IBOutlet weak var window: NSWindow! 15 | 16 | func applicationDidFinishLaunching(_ aNotification: Notification) { 17 | window.contentViewController = TableViewController() 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /Lesson 4/Lesson 4/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Lesson 4/Lesson 4/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Lesson 4/Lesson 4/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2019 Lucas Derraugh. All rights reserved. 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /Lesson 4/Lesson 4/Lesson_4.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Lesson 4/Lesson 4/Models/SystemIcons.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SystemIcons.swift 3 | // Lesson 4 4 | // 5 | // Created by Lucas Derraugh on 8/14/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import AppKit 10 | 11 | class SystemIcons { 12 | static let names = [ 13 | NSImage.followLinkFreestandingTemplateName, 14 | NSImage.invalidDataFreestandingTemplateName, 15 | NSImage.refreshFreestandingTemplateName, 16 | NSImage.revealFreestandingTemplateName, 17 | NSImage.stopProgressFreestandingTemplateName, 18 | NSImage.menuMixedStateTemplateName, 19 | NSImage.menuOnStateTemplateName, 20 | NSImage.multipleDocumentsName, 21 | NSImage.everyoneName, 22 | NSImage.userName, 23 | NSImage.userGroupName, 24 | NSImage.userGuestName, 25 | NSImage.advancedName, 26 | NSImage.preferencesGeneralName, 27 | NSImage.userAccountsName, 28 | NSImage.statusAvailableName, 29 | NSImage.statusNoneName, 30 | NSImage.statusPartiallyAvailableName, 31 | NSImage.statusUnavailableName, 32 | NSImage.applicationIconName, 33 | NSImage.bonjourName, 34 | NSImage.folderBurnableName, 35 | NSImage.cautionName, 36 | NSImage.computerName, 37 | NSImage.folderName, 38 | NSImage.homeTemplateName, 39 | NSImage.networkName, 40 | NSImage.folderSmartName, 41 | NSImage.trashEmptyName, 42 | NSImage.trashFullName, 43 | NSImage.colorPanelName, 44 | NSImage.fontPanelName, 45 | NSImage.infoName 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /Lesson 4/Lesson 4/View Controllers/TableViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.swift 3 | // Lesson 4 4 | // 5 | // Created by Lucas Derraugh on 8/14/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class TableViewController: NSViewController {} 12 | 13 | extension TableViewController: NSTableViewDataSource { 14 | func numberOfRows(in tableView: NSTableView) -> Int { 15 | return SystemIcons.names.count 16 | } 17 | } 18 | 19 | extension TableViewController: NSTableViewDelegate { 20 | func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { 21 | guard let cell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "IconTableCell"), owner: self) as? NSTableCellView else { 22 | return nil 23 | } 24 | let iconName = SystemIcons.names[row] 25 | cell.imageView?.image = NSImage(named: iconName) 26 | cell.textField?.stringValue = iconName 27 | 28 | return cell 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Lesson 4/Lesson 4/View Controllers/TableViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 92 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5.xcodeproj/xcshareddata/xcschemes/Lesson 5.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Lesson 5 4 | // 5 | // Created by Lucas Derraugh on 8/21/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | @IBOutlet weak var window: NSWindow! 15 | 16 | 17 | func applicationDidFinishLaunching(_ aNotification: Notification) { 18 | window.contentViewController = ChatListViewController() 19 | } 20 | 21 | func applicationWillTerminate(_ aNotification: Notification) { 22 | // Insert code here to tear down your application 23 | } 24 | 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Assets.xcassets/Star.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "Star.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Assets.xcassets/Star.imageset/Star.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lucasderraugh/AppleProg-Debugging-Tutorials/652aa903956bac76edb31615e17f001816ff6ff0/Lesson 5/Lesson 5/Assets.xcassets/Star.imageset/Star.pdf -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Assets.xcassets/StarFilled.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "StarFilled.pdf" 6 | } 7 | ], 8 | "info" : { 9 | "version" : 1, 10 | "author" : "xcode" 11 | } 12 | } -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Assets.xcassets/StarFilled.imageset/StarFilled.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lucasderraugh/AppleProg-Debugging-Tutorials/652aa903956bac76edb31615e17f001816ff6ff0/Lesson 5/Lesson 5/Assets.xcassets/StarFilled.imageset/StarFilled.pdf -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2019 Lucas Derraugh. All rights reserved. 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Lesson_5.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Model/Chat.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Chat.swift 3 | // Lesson 5 4 | // 5 | // Created by Lucas Derraugh on 8/22/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Chat { 12 | let name: String 13 | let messages: [String] 14 | var favorite: Bool 15 | 16 | init(sender: String, messages: [String], favorite: Bool) { 17 | self.name = sender 18 | self.messages = messages 19 | self.favorite = favorite 20 | } 21 | 22 | static func generateChats() -> [Chat] { 23 | var chats = [ 24 | Chat(sender: "Shania", messages: ["Hey Billy!", "I'm having a party."], favorite: false), 25 | Chat(sender: "Time Zone", messages: ["Speak about destruction.", "Speak about destruction."], favorite: false), 26 | Chat(sender: "Billie", messages: ["I'm that bad type"], favorite: false), 27 | Chat(sender: "Calvin", messages: ["Don't blame it on me"], favorite: false) 28 | ] 29 | 30 | var fakeChats = [Chat]() 31 | fakeChats.reserveCapacity(100) 32 | for index in 0..<100 { 33 | fakeChats.append(Chat(sender: "Chat \(index)", messages: ["Message content of chat #\(index)"], favorite: false)) 34 | } 35 | chats.append(contentsOf: fakeChats) 36 | 37 | return chats 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/View Controllers/ChatDetailsViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChatDetailsViewController.swift 3 | // Lesson 5 4 | // 5 | // Created by Lucas Derraugh on 8/22/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class ChatDetailsViewController: NSViewController { 12 | @IBOutlet weak var nameLabel: NSTextField! 13 | @IBOutlet weak var messagesLabel: NSTextField! 14 | @IBOutlet weak var favoriteButton: Toggle! 15 | 16 | let chat: Chat 17 | let favorited: (Bool) -> Void 18 | 19 | init(chat: Chat, favorited: @escaping (Bool) -> Void) { 20 | self.chat = chat 21 | self.favorited = favorited 22 | super.init(nibName: "ChatDetailsViewController", bundle: nil) 23 | } 24 | 25 | required init?(coder: NSCoder) { 26 | fatalError("init(coder:) has not been implemented") 27 | } 28 | 29 | override func awakeFromNib() { 30 | nameLabel.stringValue = chat.name 31 | messagesLabel.stringValue = chat.messages.joined(separator: "\n") 32 | favoriteButton.state = chat.favorite ? .on : .off 33 | favoriteButton.buttonPressed = favorited(_:) 34 | } 35 | 36 | private func favorited(_ state: NSControl.StateValue) { 37 | let isFavorite = (state == .on) 38 | favorited(isFavorite) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/View Controllers/ChatDetailsViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/View Controllers/ChatListViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ChatListViewController.swift 3 | // Lesson 5 4 | // 5 | // Created by Lucas Derraugh on 8/22/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class ChatListViewController: NSViewController { 12 | 13 | @IBOutlet weak var tableView: NSTableView! 14 | 15 | var chats = Chat.generateChats() 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | tableView.doubleAction = #selector(doubleClicked(_:)) 21 | } 22 | 23 | @objc func doubleClicked(_ sender: Any) { 24 | let row = tableView.clickedRow 25 | guard row >= 0 && row < chats.count else { return } 26 | 27 | let chat = chats[row] 28 | let chatDetailsVC = ChatDetailsViewController(chat: chat, favorited: { favorite in 29 | chat.favorite = favorite 30 | self.tableView.reloadData() 31 | }) 32 | 33 | guard let cell = tableView.view(atColumn: 0, row: row, makeIfNecessary: false) else { return } 34 | present(chatDetailsVC, asPopoverRelativeTo: cell.bounds, of: cell, preferredEdge: .maxX, behavior: .transient) 35 | } 36 | } 37 | 38 | extension ChatListViewController: NSTableViewDataSource { 39 | func numberOfRows(in tableView: NSTableView) -> Int { 40 | return chats.count 41 | } 42 | } 43 | 44 | extension ChatListViewController: NSTableViewDelegate { 45 | func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? { 46 | guard let cell = tableView.makeView(withIdentifier: TableCell.identifier, owner: self) as? TableCell else { 47 | return nil 48 | } 49 | 50 | let chat = chats[row] 51 | cell.configure(name: chat.name, message: chat.messages.last ?? "", isFavorite: chat.favorite, buttonPressed: { state in 52 | chat.favorite = (state == .on) 53 | print(cell) 54 | }) 55 | 56 | return cell 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/View Controllers/ChatListViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 110 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Views/TableCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TableCell.swift 3 | // Lesson 5 4 | // 5 | // Created by Lucas Derraugh on 8/22/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class TableCell: NSTableCellView { 12 | static let identifier = NSUserInterfaceItemIdentifier(rawValue: "TableCellIdentifier") 13 | 14 | @IBOutlet private weak var nameLabel: NSTextField! 15 | @IBOutlet private weak var messageLabel: NSTextField! 16 | @IBOutlet private weak var toggle: Toggle! 17 | 18 | override func prepareForReuse() { 19 | print("Preparing for reuse with current values: \(nameLabel.stringValue): \(messageLabel.stringValue)") 20 | } 21 | 22 | func configure(name: String, message: String, isFavorite: Bool, buttonPressed: @escaping (NSControl.StateValue) -> Void) { 23 | nameLabel.stringValue = name 24 | messageLabel.stringValue = message 25 | toggle.state = isFavorite ? .on : .off 26 | toggle.buttonPressed = buttonPressed 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Lesson 5/Lesson 5/Views/Toggle.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Toggle.swift 3 | // Lesson 5 4 | // 5 | // Created by Lucas Derraugh on 8/22/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class Toggle: NSButton { 12 | 13 | var buttonPressed: ((NSControl.StateValue) -> Void)? 14 | 15 | override init(frame frameRect: NSRect) { 16 | super.init(frame: frameRect) 17 | commonInit() 18 | } 19 | 20 | required init?(coder: NSCoder) { 21 | super.init(coder: coder) 22 | commonInit() 23 | } 24 | 25 | func commonInit() { 26 | self.target = self 27 | self.action = #selector(buttonPressed(_:)) 28 | } 29 | 30 | @objc private func buttonPressed(_ sender: NSButton) { 31 | buttonPressed?(sender.state) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Lesson 6/Lesson 6.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D44D202233D9E070007D20F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D44D201233D9E070007D20F /* AppDelegate.swift */; }; 11 | 1D44D204233D9E080007D20F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1D44D203233D9E080007D20F /* Assets.xcassets */; }; 12 | 1D44D207233D9E080007D20F /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D44D205233D9E080007D20F /* MainMenu.xib */; }; 13 | /* End PBXBuildFile section */ 14 | 15 | /* Begin PBXFileReference section */ 16 | 1D44D1FE233D9E070007D20F /* Lesson 6.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Lesson 6.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 17 | 1D44D201233D9E070007D20F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 18 | 1D44D203233D9E080007D20F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 19 | 1D44D206233D9E080007D20F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 20 | 1D44D208233D9E080007D20F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 21 | 1D44D209233D9E080007D20F /* Lesson_6.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Lesson_6.entitlements; sourceTree = ""; }; 22 | /* End PBXFileReference section */ 23 | 24 | /* Begin PBXFrameworksBuildPhase section */ 25 | 1D44D1FB233D9E070007D20F /* Frameworks */ = { 26 | isa = PBXFrameworksBuildPhase; 27 | buildActionMask = 2147483647; 28 | files = ( 29 | ); 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | /* End PBXFrameworksBuildPhase section */ 33 | 34 | /* Begin PBXGroup section */ 35 | 1D44D1F5233D9E070007D20F = { 36 | isa = PBXGroup; 37 | children = ( 38 | 1D44D200233D9E070007D20F /* Lesson 6 */, 39 | 1D44D1FF233D9E070007D20F /* Products */, 40 | ); 41 | sourceTree = ""; 42 | }; 43 | 1D44D1FF233D9E070007D20F /* Products */ = { 44 | isa = PBXGroup; 45 | children = ( 46 | 1D44D1FE233D9E070007D20F /* Lesson 6.app */, 47 | ); 48 | name = Products; 49 | sourceTree = ""; 50 | }; 51 | 1D44D200233D9E070007D20F /* Lesson 6 */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | 1D44D201233D9E070007D20F /* AppDelegate.swift */, 55 | 1D44D203233D9E080007D20F /* Assets.xcassets */, 56 | 1D44D205233D9E080007D20F /* MainMenu.xib */, 57 | 1D44D208233D9E080007D20F /* Info.plist */, 58 | 1D44D209233D9E080007D20F /* Lesson_6.entitlements */, 59 | ); 60 | path = "Lesson 6"; 61 | sourceTree = ""; 62 | }; 63 | /* End PBXGroup section */ 64 | 65 | /* Begin PBXNativeTarget section */ 66 | 1D44D1FD233D9E070007D20F /* Lesson 6 */ = { 67 | isa = PBXNativeTarget; 68 | buildConfigurationList = 1D44D20C233D9E080007D20F /* Build configuration list for PBXNativeTarget "Lesson 6" */; 69 | buildPhases = ( 70 | 1D44D1FA233D9E070007D20F /* Sources */, 71 | 1D44D1FB233D9E070007D20F /* Frameworks */, 72 | 1D44D1FC233D9E070007D20F /* Resources */, 73 | ); 74 | buildRules = ( 75 | ); 76 | dependencies = ( 77 | ); 78 | name = "Lesson 6"; 79 | productName = "Lesson 6"; 80 | productReference = 1D44D1FE233D9E070007D20F /* Lesson 6.app */; 81 | productType = "com.apple.product-type.application"; 82 | }; 83 | /* End PBXNativeTarget section */ 84 | 85 | /* Begin PBXProject section */ 86 | 1D44D1F6233D9E070007D20F /* Project object */ = { 87 | isa = PBXProject; 88 | attributes = { 89 | LastSwiftUpdateCheck = 1100; 90 | LastUpgradeCheck = 1100; 91 | ORGANIZATIONNAME = "Lucas Derraugh"; 92 | TargetAttributes = { 93 | 1D44D1FD233D9E070007D20F = { 94 | CreatedOnToolsVersion = 11.0; 95 | }; 96 | }; 97 | }; 98 | buildConfigurationList = 1D44D1F9233D9E070007D20F /* Build configuration list for PBXProject "Lesson 6" */; 99 | compatibilityVersion = "Xcode 9.3"; 100 | developmentRegion = en; 101 | hasScannedForEncodings = 0; 102 | knownRegions = ( 103 | en, 104 | Base, 105 | ); 106 | mainGroup = 1D44D1F5233D9E070007D20F; 107 | productRefGroup = 1D44D1FF233D9E070007D20F /* Products */; 108 | projectDirPath = ""; 109 | projectRoot = ""; 110 | targets = ( 111 | 1D44D1FD233D9E070007D20F /* Lesson 6 */, 112 | ); 113 | }; 114 | /* End PBXProject section */ 115 | 116 | /* Begin PBXResourcesBuildPhase section */ 117 | 1D44D1FC233D9E070007D20F /* Resources */ = { 118 | isa = PBXResourcesBuildPhase; 119 | buildActionMask = 2147483647; 120 | files = ( 121 | 1D44D204233D9E080007D20F /* Assets.xcassets in Resources */, 122 | 1D44D207233D9E080007D20F /* MainMenu.xib in Resources */, 123 | ); 124 | runOnlyForDeploymentPostprocessing = 0; 125 | }; 126 | /* End PBXResourcesBuildPhase section */ 127 | 128 | /* Begin PBXSourcesBuildPhase section */ 129 | 1D44D1FA233D9E070007D20F /* Sources */ = { 130 | isa = PBXSourcesBuildPhase; 131 | buildActionMask = 2147483647; 132 | files = ( 133 | 1D44D202233D9E070007D20F /* AppDelegate.swift in Sources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXSourcesBuildPhase section */ 138 | 139 | /* Begin PBXVariantGroup section */ 140 | 1D44D205233D9E080007D20F /* MainMenu.xib */ = { 141 | isa = PBXVariantGroup; 142 | children = ( 143 | 1D44D206233D9E080007D20F /* Base */, 144 | ); 145 | name = MainMenu.xib; 146 | sourceTree = ""; 147 | }; 148 | /* End PBXVariantGroup section */ 149 | 150 | /* Begin XCBuildConfiguration section */ 151 | 1D44D20A233D9E080007D20F /* Debug */ = { 152 | isa = XCBuildConfiguration; 153 | buildSettings = { 154 | ALWAYS_SEARCH_USER_PATHS = NO; 155 | CLANG_ANALYZER_NONNULL = YES; 156 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 157 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 158 | CLANG_CXX_LIBRARY = "libc++"; 159 | CLANG_ENABLE_MODULES = YES; 160 | CLANG_ENABLE_OBJC_ARC = YES; 161 | CLANG_ENABLE_OBJC_WEAK = YES; 162 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 163 | CLANG_WARN_BOOL_CONVERSION = YES; 164 | CLANG_WARN_COMMA = YES; 165 | CLANG_WARN_CONSTANT_CONVERSION = YES; 166 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 167 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 168 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 169 | CLANG_WARN_EMPTY_BODY = YES; 170 | CLANG_WARN_ENUM_CONVERSION = YES; 171 | CLANG_WARN_INFINITE_RECURSION = YES; 172 | CLANG_WARN_INT_CONVERSION = YES; 173 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 174 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 175 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 176 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 177 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 178 | CLANG_WARN_STRICT_PROTOTYPES = YES; 179 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 180 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 181 | CLANG_WARN_UNREACHABLE_CODE = YES; 182 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 183 | COPY_PHASE_STRIP = NO; 184 | DEBUG_INFORMATION_FORMAT = dwarf; 185 | ENABLE_STRICT_OBJC_MSGSEND = YES; 186 | ENABLE_TESTABILITY = YES; 187 | GCC_C_LANGUAGE_STANDARD = gnu11; 188 | GCC_DYNAMIC_NO_PIC = NO; 189 | GCC_NO_COMMON_BLOCKS = YES; 190 | GCC_OPTIMIZATION_LEVEL = 0; 191 | GCC_PREPROCESSOR_DEFINITIONS = ( 192 | "DEBUG=1", 193 | "$(inherited)", 194 | ); 195 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 196 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 197 | GCC_WARN_UNDECLARED_SELECTOR = YES; 198 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 199 | GCC_WARN_UNUSED_FUNCTION = YES; 200 | GCC_WARN_UNUSED_VARIABLE = YES; 201 | MACOSX_DEPLOYMENT_TARGET = 10.14; 202 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 203 | MTL_FAST_MATH = YES; 204 | ONLY_ACTIVE_ARCH = YES; 205 | SDKROOT = macosx; 206 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 207 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 208 | }; 209 | name = Debug; 210 | }; 211 | 1D44D20B233D9E080007D20F /* Release */ = { 212 | isa = XCBuildConfiguration; 213 | buildSettings = { 214 | ALWAYS_SEARCH_USER_PATHS = NO; 215 | CLANG_ANALYZER_NONNULL = YES; 216 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 217 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 218 | CLANG_CXX_LIBRARY = "libc++"; 219 | CLANG_ENABLE_MODULES = YES; 220 | CLANG_ENABLE_OBJC_ARC = YES; 221 | CLANG_ENABLE_OBJC_WEAK = YES; 222 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 223 | CLANG_WARN_BOOL_CONVERSION = YES; 224 | CLANG_WARN_COMMA = YES; 225 | CLANG_WARN_CONSTANT_CONVERSION = YES; 226 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 227 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 228 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 229 | CLANG_WARN_EMPTY_BODY = YES; 230 | CLANG_WARN_ENUM_CONVERSION = YES; 231 | CLANG_WARN_INFINITE_RECURSION = YES; 232 | CLANG_WARN_INT_CONVERSION = YES; 233 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 234 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 235 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 236 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 237 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 238 | CLANG_WARN_STRICT_PROTOTYPES = YES; 239 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 240 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 241 | CLANG_WARN_UNREACHABLE_CODE = YES; 242 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 243 | COPY_PHASE_STRIP = NO; 244 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 245 | ENABLE_NS_ASSERTIONS = NO; 246 | ENABLE_STRICT_OBJC_MSGSEND = YES; 247 | GCC_C_LANGUAGE_STANDARD = gnu11; 248 | GCC_NO_COMMON_BLOCKS = YES; 249 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 250 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 251 | GCC_WARN_UNDECLARED_SELECTOR = YES; 252 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 253 | GCC_WARN_UNUSED_FUNCTION = YES; 254 | GCC_WARN_UNUSED_VARIABLE = YES; 255 | MACOSX_DEPLOYMENT_TARGET = 10.14; 256 | MTL_ENABLE_DEBUG_INFO = NO; 257 | MTL_FAST_MATH = YES; 258 | SDKROOT = macosx; 259 | SWIFT_COMPILATION_MODE = wholemodule; 260 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 261 | }; 262 | name = Release; 263 | }; 264 | 1D44D20D233D9E080007D20F /* Debug */ = { 265 | isa = XCBuildConfiguration; 266 | buildSettings = { 267 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 268 | CODE_SIGN_ENTITLEMENTS = "Lesson 6/Lesson_6.entitlements"; 269 | CODE_SIGN_STYLE = Automatic; 270 | COMBINE_HIDPI_IMAGES = YES; 271 | DEVELOPMENT_TEAM = FP44AY6HHW; 272 | ENABLE_HARDENED_RUNTIME = YES; 273 | INFOPLIST_FILE = "Lesson 6/Info.plist"; 274 | LD_RUNPATH_SEARCH_PATHS = ( 275 | "$(inherited)", 276 | "@executable_path/../Frameworks", 277 | ); 278 | PRODUCT_BUNDLE_IDENTIFIER = "com.lucasderraugh.Lesson-6"; 279 | PRODUCT_NAME = "$(TARGET_NAME)"; 280 | SWIFT_VERSION = 5.0; 281 | }; 282 | name = Debug; 283 | }; 284 | 1D44D20E233D9E080007D20F /* Release */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 288 | CODE_SIGN_ENTITLEMENTS = "Lesson 6/Lesson_6.entitlements"; 289 | CODE_SIGN_STYLE = Automatic; 290 | COMBINE_HIDPI_IMAGES = YES; 291 | DEVELOPMENT_TEAM = FP44AY6HHW; 292 | ENABLE_HARDENED_RUNTIME = YES; 293 | INFOPLIST_FILE = "Lesson 6/Info.plist"; 294 | LD_RUNPATH_SEARCH_PATHS = ( 295 | "$(inherited)", 296 | "@executable_path/../Frameworks", 297 | ); 298 | PRODUCT_BUNDLE_IDENTIFIER = "com.lucasderraugh.Lesson-6"; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | SWIFT_VERSION = 5.0; 301 | }; 302 | name = Release; 303 | }; 304 | /* End XCBuildConfiguration section */ 305 | 306 | /* Begin XCConfigurationList section */ 307 | 1D44D1F9233D9E070007D20F /* Build configuration list for PBXProject "Lesson 6" */ = { 308 | isa = XCConfigurationList; 309 | buildConfigurations = ( 310 | 1D44D20A233D9E080007D20F /* Debug */, 311 | 1D44D20B233D9E080007D20F /* Release */, 312 | ); 313 | defaultConfigurationIsVisible = 0; 314 | defaultConfigurationName = Release; 315 | }; 316 | 1D44D20C233D9E080007D20F /* Build configuration list for PBXNativeTarget "Lesson 6" */ = { 317 | isa = XCConfigurationList; 318 | buildConfigurations = ( 319 | 1D44D20D233D9E080007D20F /* Debug */, 320 | 1D44D20E233D9E080007D20F /* Release */, 321 | ); 322 | defaultConfigurationIsVisible = 0; 323 | defaultConfigurationName = Release; 324 | }; 325 | /* End XCConfigurationList section */ 326 | }; 327 | rootObject = 1D44D1F6233D9E070007D20F /* Project object */; 328 | } 329 | -------------------------------------------------------------------------------- /Lesson 6/Lesson 6.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lesson 6/Lesson 6.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lesson 6/Lesson 6.xcodeproj/xcshareddata/xcschemes/Lesson 6.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 44 | 46 | 52 | 53 | 54 | 55 | 61 | 63 | 69 | 70 | 71 | 72 | 74 | 75 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /Lesson 6/Lesson 6/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Lesson 6 4 | // 5 | // Created by Lucas Derraugh on 9/26/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | @IBOutlet weak var window: NSWindow! 15 | 16 | let queue1 = DispatchQueue(label: "com.lucas.lesson6.queue1") 17 | 18 | func applicationDidFinishLaunching(_ aNotification: Notification) { 19 | var count = 0 20 | queue1.async { 21 | for _ in 0..<1000 { 22 | count += 1 23 | } 24 | } 25 | 26 | for _ in 0..<1000 { 27 | count += 1 28 | } 29 | 30 | DispatchQueue.main.asyncAfter(deadline: .now() + 1) { 31 | print("Count: ", count) 32 | } 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /Lesson 6/Lesson 6/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Lesson 6/Lesson 6/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Lesson 6/Lesson 6/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2019 Lucas Derraugh. All rights reserved. 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | NSSupportsAutomaticTermination 32 | 33 | NSSupportsSuddenTermination 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Lesson 6/Lesson 6/Lesson_6.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Lesson 7/Lesson 7.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D2272A62345A71500FE2614 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D2272A52345A71500FE2614 /* main.swift */; }; 11 | 1D2272B22345ACB400FE2614 /* GameBoard.c in Sources */ = {isa = PBXBuildFile; fileRef = 1D2272B02345ACB400FE2614 /* GameBoard.c */; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXCopyFilesBuildPhase section */ 15 | 1D2272A02345A71500FE2614 /* CopyFiles */ = { 16 | isa = PBXCopyFilesBuildPhase; 17 | buildActionMask = 2147483647; 18 | dstPath = /usr/share/man/man1/; 19 | dstSubfolderSpec = 0; 20 | files = ( 21 | ); 22 | runOnlyForDeploymentPostprocessing = 1; 23 | }; 24 | /* End PBXCopyFilesBuildPhase section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 1D2272A22345A71500FE2614 /* Lesson 7 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Lesson 7"; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 1D2272A52345A71500FE2614 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = ""; }; 29 | 1D2272AC2345AB2F00FE2614 /* Lesson 7-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Lesson 7-Bridging-Header.h"; sourceTree = ""; }; 30 | 1D2272B02345ACB400FE2614 /* GameBoard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = GameBoard.c; sourceTree = ""; }; 31 | 1D2272B12345ACB400FE2614 /* GameBoard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameBoard.h; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | 1D22729F2345A71500FE2614 /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | 1D2272992345A71500FE2614 = { 46 | isa = PBXGroup; 47 | children = ( 48 | 1D2272A42345A71500FE2614 /* Lesson 7 */, 49 | 1D2272A32345A71500FE2614 /* Products */, 50 | ); 51 | sourceTree = ""; 52 | }; 53 | 1D2272A32345A71500FE2614 /* Products */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | 1D2272A22345A71500FE2614 /* Lesson 7 */, 57 | ); 58 | name = Products; 59 | sourceTree = ""; 60 | }; 61 | 1D2272A42345A71500FE2614 /* Lesson 7 */ = { 62 | isa = PBXGroup; 63 | children = ( 64 | 1D2272A52345A71500FE2614 /* main.swift */, 65 | 1D2272B12345ACB400FE2614 /* GameBoard.h */, 66 | 1D2272B02345ACB400FE2614 /* GameBoard.c */, 67 | 1D2272AC2345AB2F00FE2614 /* Lesson 7-Bridging-Header.h */, 68 | ); 69 | path = "Lesson 7"; 70 | sourceTree = ""; 71 | }; 72 | /* End PBXGroup section */ 73 | 74 | /* Begin PBXNativeTarget section */ 75 | 1D2272A12345A71500FE2614 /* Lesson 7 */ = { 76 | isa = PBXNativeTarget; 77 | buildConfigurationList = 1D2272A92345A71500FE2614 /* Build configuration list for PBXNativeTarget "Lesson 7" */; 78 | buildPhases = ( 79 | 1D22729E2345A71500FE2614 /* Sources */, 80 | 1D22729F2345A71500FE2614 /* Frameworks */, 81 | 1D2272A02345A71500FE2614 /* CopyFiles */, 82 | ); 83 | buildRules = ( 84 | ); 85 | dependencies = ( 86 | ); 87 | name = "Lesson 7"; 88 | productName = "Lesson 7"; 89 | productReference = 1D2272A22345A71500FE2614 /* Lesson 7 */; 90 | productType = "com.apple.product-type.tool"; 91 | }; 92 | /* End PBXNativeTarget section */ 93 | 94 | /* Begin PBXProject section */ 95 | 1D22729A2345A71500FE2614 /* Project object */ = { 96 | isa = PBXProject; 97 | attributes = { 98 | LastSwiftUpdateCheck = 1100; 99 | LastUpgradeCheck = 1100; 100 | ORGANIZATIONNAME = "Lucas Derraugh"; 101 | TargetAttributes = { 102 | 1D2272A12345A71500FE2614 = { 103 | CreatedOnToolsVersion = 11.0; 104 | LastSwiftMigration = 1100; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = 1D22729D2345A71500FE2614 /* Build configuration list for PBXProject "Lesson 7" */; 109 | compatibilityVersion = "Xcode 9.3"; 110 | developmentRegion = en; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = 1D2272992345A71500FE2614; 117 | productRefGroup = 1D2272A32345A71500FE2614 /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | 1D2272A12345A71500FE2614 /* Lesson 7 */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXSourcesBuildPhase section */ 127 | 1D22729E2345A71500FE2614 /* Sources */ = { 128 | isa = PBXSourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | 1D2272B22345ACB400FE2614 /* GameBoard.c in Sources */, 132 | 1D2272A62345A71500FE2614 /* main.swift in Sources */, 133 | ); 134 | runOnlyForDeploymentPostprocessing = 0; 135 | }; 136 | /* End PBXSourcesBuildPhase section */ 137 | 138 | /* Begin XCBuildConfiguration section */ 139 | 1D2272A72345A71500FE2614 /* Debug */ = { 140 | isa = XCBuildConfiguration; 141 | buildSettings = { 142 | ALWAYS_SEARCH_USER_PATHS = NO; 143 | CLANG_ANALYZER_NONNULL = YES; 144 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 145 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 146 | CLANG_CXX_LIBRARY = "libc++"; 147 | CLANG_ENABLE_MODULES = YES; 148 | CLANG_ENABLE_OBJC_ARC = YES; 149 | CLANG_ENABLE_OBJC_WEAK = YES; 150 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 151 | CLANG_WARN_BOOL_CONVERSION = YES; 152 | CLANG_WARN_COMMA = YES; 153 | CLANG_WARN_CONSTANT_CONVERSION = YES; 154 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 155 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 156 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 157 | CLANG_WARN_EMPTY_BODY = YES; 158 | CLANG_WARN_ENUM_CONVERSION = YES; 159 | CLANG_WARN_INFINITE_RECURSION = YES; 160 | CLANG_WARN_INT_CONVERSION = YES; 161 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 162 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 163 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 164 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 165 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 166 | CLANG_WARN_STRICT_PROTOTYPES = YES; 167 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 168 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 169 | CLANG_WARN_UNREACHABLE_CODE = YES; 170 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 171 | COPY_PHASE_STRIP = NO; 172 | DEBUG_INFORMATION_FORMAT = dwarf; 173 | ENABLE_STRICT_OBJC_MSGSEND = YES; 174 | ENABLE_TESTABILITY = YES; 175 | GCC_C_LANGUAGE_STANDARD = gnu11; 176 | GCC_DYNAMIC_NO_PIC = NO; 177 | GCC_NO_COMMON_BLOCKS = YES; 178 | GCC_OPTIMIZATION_LEVEL = 0; 179 | GCC_PREPROCESSOR_DEFINITIONS = ( 180 | "DEBUG=1", 181 | "$(inherited)", 182 | ); 183 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 184 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 185 | GCC_WARN_UNDECLARED_SELECTOR = YES; 186 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 187 | GCC_WARN_UNUSED_FUNCTION = YES; 188 | GCC_WARN_UNUSED_VARIABLE = YES; 189 | MACOSX_DEPLOYMENT_TARGET = 10.14; 190 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 191 | MTL_FAST_MATH = YES; 192 | ONLY_ACTIVE_ARCH = YES; 193 | SDKROOT = macosx; 194 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 195 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 196 | }; 197 | name = Debug; 198 | }; 199 | 1D2272A82345A71500FE2614 /* Release */ = { 200 | isa = XCBuildConfiguration; 201 | buildSettings = { 202 | ALWAYS_SEARCH_USER_PATHS = NO; 203 | CLANG_ANALYZER_NONNULL = YES; 204 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 205 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 206 | CLANG_CXX_LIBRARY = "libc++"; 207 | CLANG_ENABLE_MODULES = YES; 208 | CLANG_ENABLE_OBJC_ARC = YES; 209 | CLANG_ENABLE_OBJC_WEAK = YES; 210 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 211 | CLANG_WARN_BOOL_CONVERSION = YES; 212 | CLANG_WARN_COMMA = YES; 213 | CLANG_WARN_CONSTANT_CONVERSION = YES; 214 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 215 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 216 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 217 | CLANG_WARN_EMPTY_BODY = YES; 218 | CLANG_WARN_ENUM_CONVERSION = YES; 219 | CLANG_WARN_INFINITE_RECURSION = YES; 220 | CLANG_WARN_INT_CONVERSION = YES; 221 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 222 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 223 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 224 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 225 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 226 | CLANG_WARN_STRICT_PROTOTYPES = YES; 227 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 228 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 229 | CLANG_WARN_UNREACHABLE_CODE = YES; 230 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 231 | COPY_PHASE_STRIP = NO; 232 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 233 | ENABLE_NS_ASSERTIONS = NO; 234 | ENABLE_STRICT_OBJC_MSGSEND = YES; 235 | GCC_C_LANGUAGE_STANDARD = gnu11; 236 | GCC_NO_COMMON_BLOCKS = YES; 237 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 238 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 239 | GCC_WARN_UNDECLARED_SELECTOR = YES; 240 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 241 | GCC_WARN_UNUSED_FUNCTION = YES; 242 | GCC_WARN_UNUSED_VARIABLE = YES; 243 | MACOSX_DEPLOYMENT_TARGET = 10.14; 244 | MTL_ENABLE_DEBUG_INFO = NO; 245 | MTL_FAST_MATH = YES; 246 | SDKROOT = macosx; 247 | SWIFT_COMPILATION_MODE = wholemodule; 248 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 249 | }; 250 | name = Release; 251 | }; 252 | 1D2272AA2345A71500FE2614 /* Debug */ = { 253 | isa = XCBuildConfiguration; 254 | buildSettings = { 255 | CLANG_ENABLE_MODULES = YES; 256 | CODE_SIGN_STYLE = Automatic; 257 | DEVELOPMENT_TEAM = FP44AY6HHW; 258 | ENABLE_HARDENED_RUNTIME = YES; 259 | LD_RUNPATH_SEARCH_PATHS = ( 260 | "$(inherited)", 261 | "@executable_path/../Frameworks", 262 | "@loader_path/../Frameworks", 263 | ); 264 | PRODUCT_NAME = "$(TARGET_NAME)"; 265 | SWIFT_OBJC_BRIDGING_HEADER = "Lesson 7/Lesson 7-Bridging-Header.h"; 266 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 267 | SWIFT_VERSION = 5.0; 268 | }; 269 | name = Debug; 270 | }; 271 | 1D2272AB2345A71500FE2614 /* Release */ = { 272 | isa = XCBuildConfiguration; 273 | buildSettings = { 274 | CLANG_ENABLE_MODULES = YES; 275 | CODE_SIGN_STYLE = Automatic; 276 | DEVELOPMENT_TEAM = FP44AY6HHW; 277 | ENABLE_HARDENED_RUNTIME = YES; 278 | LD_RUNPATH_SEARCH_PATHS = ( 279 | "$(inherited)", 280 | "@executable_path/../Frameworks", 281 | "@loader_path/../Frameworks", 282 | ); 283 | PRODUCT_NAME = "$(TARGET_NAME)"; 284 | SWIFT_OBJC_BRIDGING_HEADER = "Lesson 7/Lesson 7-Bridging-Header.h"; 285 | SWIFT_VERSION = 5.0; 286 | }; 287 | name = Release; 288 | }; 289 | /* End XCBuildConfiguration section */ 290 | 291 | /* Begin XCConfigurationList section */ 292 | 1D22729D2345A71500FE2614 /* Build configuration list for PBXProject "Lesson 7" */ = { 293 | isa = XCConfigurationList; 294 | buildConfigurations = ( 295 | 1D2272A72345A71500FE2614 /* Debug */, 296 | 1D2272A82345A71500FE2614 /* Release */, 297 | ); 298 | defaultConfigurationIsVisible = 0; 299 | defaultConfigurationName = Release; 300 | }; 301 | 1D2272A92345A71500FE2614 /* Build configuration list for PBXNativeTarget "Lesson 7" */ = { 302 | isa = XCConfigurationList; 303 | buildConfigurations = ( 304 | 1D2272AA2345A71500FE2614 /* Debug */, 305 | 1D2272AB2345A71500FE2614 /* Release */, 306 | ); 307 | defaultConfigurationIsVisible = 0; 308 | defaultConfigurationName = Release; 309 | }; 310 | /* End XCConfigurationList section */ 311 | }; 312 | rootObject = 1D22729A2345A71500FE2614 /* Project object */; 313 | } 314 | -------------------------------------------------------------------------------- /Lesson 7/Lesson 7.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lesson 7/Lesson 7.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lesson 7/Lesson 7.xcodeproj/xcshareddata/xcschemes/Lesson 7.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 45 | 47 | 53 | 54 | 55 | 56 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Lesson 7/Lesson 7/GameBoard.c: -------------------------------------------------------------------------------- 1 | // 2 | // GameBoard.c 3 | // Lesson 1 4 | // 5 | // Created by Lucas Derraugh on 9/5/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | #include "GameBoard.h" 10 | 11 | const GameBoard * GameBoardCreate(int p1Score, int p2Score) { 12 | GameBoard g = { 13 | .p1Score = p1Score, 14 | .p2Score = p2Score 15 | }; 16 | return &g; 17 | } 18 | -------------------------------------------------------------------------------- /Lesson 7/Lesson 7/GameBoard.h: -------------------------------------------------------------------------------- 1 | // 2 | // GameBoard.h 3 | // Lesson 1 4 | // 5 | // Created by Lucas Derraugh on 9/5/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | #ifndef GameBoard_h 10 | #define GameBoard_h 11 | 12 | #include 13 | 14 | typedef struct { 15 | int p1Score; 16 | int p2Score; 17 | } GameBoard; 18 | 19 | const GameBoard * _Nonnull GameBoardCreate(int p1Score, int p2Score); 20 | 21 | #endif /* GameBoard_h */ 22 | -------------------------------------------------------------------------------- /Lesson 7/Lesson 7/Lesson 7-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "GameBoard.h" 6 | -------------------------------------------------------------------------------- /Lesson 7/Lesson 7/main.swift: -------------------------------------------------------------------------------- 1 | // 2 | // main.swift 3 | // Lesson 7 4 | // 5 | // Created by Lucas Derraugh on 10/2/19. 6 | // Copyright © 2019 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | // Heap Buffer Overflow 12 | let count = 4 13 | let stride = MemoryLayout.stride 14 | let alignment = MemoryLayout.alignment 15 | let byteCount = stride * count 16 | let mutableRawPtr = UnsafeMutableRawPointer.allocate(byteCount: count, alignment: alignment) 17 | 18 | mutableRawPtr.storeBytes(of: 76, as: CChar.self) // L 19 | mutableRawPtr.advanced(by: stride).storeBytes(of: 117, as: CChar.self) // u 20 | mutableRawPtr.advanced(by: stride * 2).storeBytes(of: 99, as: CChar.self) // c 21 | mutableRawPtr.advanced(by: stride * 3).storeBytes(of: 0, as: CChar.self) // \0 22 | 23 | print(String(cString: mutableRawPtr.bindMemory(to: CChar.self, capacity: count))) 24 | 25 | 26 | // Use after return 27 | //let gameBoard = GameBoardCreate(5, 12) 28 | //print("\(gameBoard.pointee.p1Score) vs \(gameBoard.pointee.p2Score)") 29 | 30 | 31 | // Use after free 32 | func createRandomNumberBuffer(count: Int, upperBound: UInt32) -> UnsafeMutableBufferPointer { 33 | let buffer = UnsafeMutableBufferPointer.allocate(capacity: count) 34 | buffer.deallocate() 35 | for slot in 0.. 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lesson 8/Lesson 8.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lesson 8/Lesson 8/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Lesson 8 4 | // 5 | // Created by Lucas Derraugh on 1/9/20. 6 | // Copyright © 2020 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | @IBOutlet weak var window: NSWindow! 15 | 16 | func applicationWillFinishLaunching(_ notification: Notification) { 17 | let original = Selector("updateLayer") 18 | let swizzle = Selector("xxx_updateLayer") 19 | if let widgetClass = NSClassFromString("NSWidgetView"), 20 | let originalMethod = class_getInstanceMethod(widgetClass, original), 21 | let swizzleMethod = class_getInstanceMethod(NSView.self, swizzle) { 22 | method_exchangeImplementations(originalMethod, swizzleMethod) 23 | } 24 | } 25 | 26 | } 27 | 28 | extension NSView { 29 | @objc func xxx_updateLayer() { 30 | 31 | // Calls the original updateLayer 32 | self.xxx_updateLayer() 33 | 34 | guard let dictionary = self.value(forKey: "widgetDefinition") as? [String: Any], 35 | let widget = dictionary["widget"] as? String, 36 | let value = (dictionary["value"] as? NSNumber)?.intValue else { 37 | return 38 | } 39 | 40 | if widget == "kCUIWidgetSwitchFill" { 41 | layer?.contents = nil 42 | if value == 0 { 43 | layer?.backgroundColor = NSColor.red.cgColor 44 | } else { 45 | layer?.backgroundColor = NSColor.green.cgColor 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Lesson 8/Lesson 8/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Lesson 8/Lesson 8/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Lesson 8/Lesson 8/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2020 Lucas Derraugh. All rights reserved. 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | NSSupportsAutomaticTermination 32 | 33 | NSSupportsSuddenTermination 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Lesson 8/Lesson 8/Lesson_8.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D34826523E206A400694D62 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D34826423E206A400694D62 /* AppDelegate.swift */; }; 11 | 1D34826723E206A600694D62 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1D34826623E206A600694D62 /* Assets.xcassets */; }; 12 | 1D34826A23E206A600694D62 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D34826823E206A600694D62 /* MainMenu.xib */; }; 13 | 1D34827423E2568300694D62 /* PictureCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D34827223E2568300694D62 /* PictureCollectionViewController.swift */; }; 14 | 1D34827523E2568300694D62 /* PictureCollectionViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D34827323E2568300694D62 /* PictureCollectionViewController.xib */; }; 15 | 1D34827C23E27C7E00694D62 /* PictureCollectionViewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1D34827A23E27C7E00694D62 /* PictureCollectionViewItem.swift */; }; 16 | 1D34827D23E27C7E00694D62 /* PictureCollectionViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1D34827B23E27C7E00694D62 /* PictureCollectionViewItem.xib */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 1D34826123E206A400694D62 /* Lesson 9.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Lesson 9.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 1D34826423E206A400694D62 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 1D34826623E206A600694D62 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 23 | 1D34826923E206A600694D62 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 24 | 1D34826B23E206A600694D62 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 25 | 1D34826C23E206A600694D62 /* Lesson_9.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Lesson_9.entitlements; sourceTree = ""; }; 26 | 1D34827223E2568300694D62 /* PictureCollectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PictureCollectionViewController.swift; sourceTree = ""; }; 27 | 1D34827323E2568300694D62 /* PictureCollectionViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PictureCollectionViewController.xib; sourceTree = ""; }; 28 | 1D34827A23E27C7E00694D62 /* PictureCollectionViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PictureCollectionViewItem.swift; sourceTree = ""; }; 29 | 1D34827B23E27C7E00694D62 /* PictureCollectionViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PictureCollectionViewItem.xib; sourceTree = ""; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | 1D34825E23E206A400694D62 /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | 1D34825823E206A400694D62 = { 44 | isa = PBXGroup; 45 | children = ( 46 | 1D34826323E206A400694D62 /* Lesson 9 */, 47 | 1D34826223E206A400694D62 /* Products */, 48 | ); 49 | sourceTree = ""; 50 | }; 51 | 1D34826223E206A400694D62 /* Products */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | 1D34826123E206A400694D62 /* Lesson 9.app */, 55 | ); 56 | name = Products; 57 | sourceTree = ""; 58 | }; 59 | 1D34826323E206A400694D62 /* Lesson 9 */ = { 60 | isa = PBXGroup; 61 | children = ( 62 | 1D34826423E206A400694D62 /* AppDelegate.swift */, 63 | 1D34827223E2568300694D62 /* PictureCollectionViewController.swift */, 64 | 1D34827323E2568300694D62 /* PictureCollectionViewController.xib */, 65 | 1D34827A23E27C7E00694D62 /* PictureCollectionViewItem.swift */, 66 | 1D34827B23E27C7E00694D62 /* PictureCollectionViewItem.xib */, 67 | 1D34826623E206A600694D62 /* Assets.xcassets */, 68 | 1D34826823E206A600694D62 /* MainMenu.xib */, 69 | 1D34826B23E206A600694D62 /* Info.plist */, 70 | 1D34826C23E206A600694D62 /* Lesson_9.entitlements */, 71 | ); 72 | path = "Lesson 9"; 73 | sourceTree = ""; 74 | }; 75 | /* End PBXGroup section */ 76 | 77 | /* Begin PBXNativeTarget section */ 78 | 1D34826023E206A400694D62 /* Lesson 9 */ = { 79 | isa = PBXNativeTarget; 80 | buildConfigurationList = 1D34826F23E206A600694D62 /* Build configuration list for PBXNativeTarget "Lesson 9" */; 81 | buildPhases = ( 82 | 1D34825D23E206A400694D62 /* Sources */, 83 | 1D34825E23E206A400694D62 /* Frameworks */, 84 | 1D34825F23E206A400694D62 /* Resources */, 85 | ); 86 | buildRules = ( 87 | ); 88 | dependencies = ( 89 | ); 90 | name = "Lesson 9"; 91 | productName = "Lesson 9"; 92 | productReference = 1D34826123E206A400694D62 /* Lesson 9.app */; 93 | productType = "com.apple.product-type.application"; 94 | }; 95 | /* End PBXNativeTarget section */ 96 | 97 | /* Begin PBXProject section */ 98 | 1D34825923E206A400694D62 /* Project object */ = { 99 | isa = PBXProject; 100 | attributes = { 101 | LastSwiftUpdateCheck = 1130; 102 | LastUpgradeCheck = 1130; 103 | ORGANIZATIONNAME = "Lucas Derraugh"; 104 | TargetAttributes = { 105 | 1D34826023E206A400694D62 = { 106 | CreatedOnToolsVersion = 11.3.1; 107 | }; 108 | }; 109 | }; 110 | buildConfigurationList = 1D34825C23E206A400694D62 /* Build configuration list for PBXProject "Lesson 9" */; 111 | compatibilityVersion = "Xcode 9.3"; 112 | developmentRegion = en; 113 | hasScannedForEncodings = 0; 114 | knownRegions = ( 115 | en, 116 | Base, 117 | ); 118 | mainGroup = 1D34825823E206A400694D62; 119 | productRefGroup = 1D34826223E206A400694D62 /* Products */; 120 | projectDirPath = ""; 121 | projectRoot = ""; 122 | targets = ( 123 | 1D34826023E206A400694D62 /* Lesson 9 */, 124 | ); 125 | }; 126 | /* End PBXProject section */ 127 | 128 | /* Begin PBXResourcesBuildPhase section */ 129 | 1D34825F23E206A400694D62 /* Resources */ = { 130 | isa = PBXResourcesBuildPhase; 131 | buildActionMask = 2147483647; 132 | files = ( 133 | 1D34827D23E27C7E00694D62 /* PictureCollectionViewItem.xib in Resources */, 134 | 1D34826723E206A600694D62 /* Assets.xcassets in Resources */, 135 | 1D34827523E2568300694D62 /* PictureCollectionViewController.xib in Resources */, 136 | 1D34826A23E206A600694D62 /* MainMenu.xib in Resources */, 137 | ); 138 | runOnlyForDeploymentPostprocessing = 0; 139 | }; 140 | /* End PBXResourcesBuildPhase section */ 141 | 142 | /* Begin PBXSourcesBuildPhase section */ 143 | 1D34825D23E206A400694D62 /* Sources */ = { 144 | isa = PBXSourcesBuildPhase; 145 | buildActionMask = 2147483647; 146 | files = ( 147 | 1D34826523E206A400694D62 /* AppDelegate.swift in Sources */, 148 | 1D34827423E2568300694D62 /* PictureCollectionViewController.swift in Sources */, 149 | 1D34827C23E27C7E00694D62 /* PictureCollectionViewItem.swift in Sources */, 150 | ); 151 | runOnlyForDeploymentPostprocessing = 0; 152 | }; 153 | /* End PBXSourcesBuildPhase section */ 154 | 155 | /* Begin PBXVariantGroup section */ 156 | 1D34826823E206A600694D62 /* MainMenu.xib */ = { 157 | isa = PBXVariantGroup; 158 | children = ( 159 | 1D34826923E206A600694D62 /* Base */, 160 | ); 161 | name = MainMenu.xib; 162 | sourceTree = ""; 163 | }; 164 | /* End PBXVariantGroup section */ 165 | 166 | /* Begin XCBuildConfiguration section */ 167 | 1D34826D23E206A600694D62 /* Debug */ = { 168 | isa = XCBuildConfiguration; 169 | buildSettings = { 170 | ALWAYS_SEARCH_USER_PATHS = NO; 171 | CLANG_ANALYZER_NONNULL = YES; 172 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 173 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 174 | CLANG_CXX_LIBRARY = "libc++"; 175 | CLANG_ENABLE_MODULES = YES; 176 | CLANG_ENABLE_OBJC_ARC = YES; 177 | CLANG_ENABLE_OBJC_WEAK = YES; 178 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 179 | CLANG_WARN_BOOL_CONVERSION = YES; 180 | CLANG_WARN_COMMA = YES; 181 | CLANG_WARN_CONSTANT_CONVERSION = YES; 182 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 183 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 184 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 185 | CLANG_WARN_EMPTY_BODY = YES; 186 | CLANG_WARN_ENUM_CONVERSION = YES; 187 | CLANG_WARN_INFINITE_RECURSION = YES; 188 | CLANG_WARN_INT_CONVERSION = YES; 189 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 190 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 191 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 192 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 193 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 194 | CLANG_WARN_STRICT_PROTOTYPES = YES; 195 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 196 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 197 | CLANG_WARN_UNREACHABLE_CODE = YES; 198 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 199 | COPY_PHASE_STRIP = NO; 200 | DEBUG_INFORMATION_FORMAT = dwarf; 201 | ENABLE_STRICT_OBJC_MSGSEND = YES; 202 | ENABLE_TESTABILITY = YES; 203 | GCC_C_LANGUAGE_STANDARD = gnu11; 204 | GCC_DYNAMIC_NO_PIC = NO; 205 | GCC_NO_COMMON_BLOCKS = YES; 206 | GCC_OPTIMIZATION_LEVEL = 0; 207 | GCC_PREPROCESSOR_DEFINITIONS = ( 208 | "DEBUG=1", 209 | "$(inherited)", 210 | ); 211 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 212 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 213 | GCC_WARN_UNDECLARED_SELECTOR = YES; 214 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 215 | GCC_WARN_UNUSED_FUNCTION = YES; 216 | GCC_WARN_UNUSED_VARIABLE = YES; 217 | MACOSX_DEPLOYMENT_TARGET = 10.15; 218 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 219 | MTL_FAST_MATH = YES; 220 | ONLY_ACTIVE_ARCH = YES; 221 | SDKROOT = macosx; 222 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 223 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 224 | }; 225 | name = Debug; 226 | }; 227 | 1D34826E23E206A600694D62 /* Release */ = { 228 | isa = XCBuildConfiguration; 229 | buildSettings = { 230 | ALWAYS_SEARCH_USER_PATHS = NO; 231 | CLANG_ANALYZER_NONNULL = YES; 232 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 233 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 234 | CLANG_CXX_LIBRARY = "libc++"; 235 | CLANG_ENABLE_MODULES = YES; 236 | CLANG_ENABLE_OBJC_ARC = YES; 237 | CLANG_ENABLE_OBJC_WEAK = YES; 238 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 239 | CLANG_WARN_BOOL_CONVERSION = YES; 240 | CLANG_WARN_COMMA = YES; 241 | CLANG_WARN_CONSTANT_CONVERSION = YES; 242 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 243 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 244 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 245 | CLANG_WARN_EMPTY_BODY = YES; 246 | CLANG_WARN_ENUM_CONVERSION = YES; 247 | CLANG_WARN_INFINITE_RECURSION = YES; 248 | CLANG_WARN_INT_CONVERSION = YES; 249 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 250 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 251 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 252 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 253 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 254 | CLANG_WARN_STRICT_PROTOTYPES = YES; 255 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 256 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 257 | CLANG_WARN_UNREACHABLE_CODE = YES; 258 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 259 | COPY_PHASE_STRIP = NO; 260 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 261 | ENABLE_NS_ASSERTIONS = NO; 262 | ENABLE_STRICT_OBJC_MSGSEND = YES; 263 | GCC_C_LANGUAGE_STANDARD = gnu11; 264 | GCC_NO_COMMON_BLOCKS = YES; 265 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 266 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 267 | GCC_WARN_UNDECLARED_SELECTOR = YES; 268 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 269 | GCC_WARN_UNUSED_FUNCTION = YES; 270 | GCC_WARN_UNUSED_VARIABLE = YES; 271 | MACOSX_DEPLOYMENT_TARGET = 10.15; 272 | MTL_ENABLE_DEBUG_INFO = NO; 273 | MTL_FAST_MATH = YES; 274 | SDKROOT = macosx; 275 | SWIFT_COMPILATION_MODE = wholemodule; 276 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 277 | }; 278 | name = Release; 279 | }; 280 | 1D34827023E206A600694D62 /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 284 | CODE_SIGN_ENTITLEMENTS = "Lesson 9/Lesson_9.entitlements"; 285 | CODE_SIGN_STYLE = Automatic; 286 | COMBINE_HIDPI_IMAGES = YES; 287 | DEVELOPMENT_TEAM = FP44AY6HHW; 288 | ENABLE_HARDENED_RUNTIME = YES; 289 | INFOPLIST_FILE = "Lesson 9/Info.plist"; 290 | LD_RUNPATH_SEARCH_PATHS = ( 291 | "$(inherited)", 292 | "@executable_path/../Frameworks", 293 | ); 294 | MACOSX_DEPLOYMENT_TARGET = 10.15.1; 295 | PRODUCT_BUNDLE_IDENTIFIER = "com.lucasderraugh.Lesson-9"; 296 | PRODUCT_NAME = "$(TARGET_NAME)"; 297 | SWIFT_VERSION = 5.0; 298 | }; 299 | name = Debug; 300 | }; 301 | 1D34827123E206A600694D62 /* Release */ = { 302 | isa = XCBuildConfiguration; 303 | buildSettings = { 304 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 305 | CODE_SIGN_ENTITLEMENTS = "Lesson 9/Lesson_9.entitlements"; 306 | CODE_SIGN_STYLE = Automatic; 307 | COMBINE_HIDPI_IMAGES = YES; 308 | DEVELOPMENT_TEAM = FP44AY6HHW; 309 | ENABLE_HARDENED_RUNTIME = YES; 310 | INFOPLIST_FILE = "Lesson 9/Info.plist"; 311 | LD_RUNPATH_SEARCH_PATHS = ( 312 | "$(inherited)", 313 | "@executable_path/../Frameworks", 314 | ); 315 | MACOSX_DEPLOYMENT_TARGET = 10.15.1; 316 | PRODUCT_BUNDLE_IDENTIFIER = "com.lucasderraugh.Lesson-9"; 317 | PRODUCT_NAME = "$(TARGET_NAME)"; 318 | SWIFT_VERSION = 5.0; 319 | }; 320 | name = Release; 321 | }; 322 | /* End XCBuildConfiguration section */ 323 | 324 | /* Begin XCConfigurationList section */ 325 | 1D34825C23E206A400694D62 /* Build configuration list for PBXProject "Lesson 9" */ = { 326 | isa = XCConfigurationList; 327 | buildConfigurations = ( 328 | 1D34826D23E206A600694D62 /* Debug */, 329 | 1D34826E23E206A600694D62 /* Release */, 330 | ); 331 | defaultConfigurationIsVisible = 0; 332 | defaultConfigurationName = Release; 333 | }; 334 | 1D34826F23E206A600694D62 /* Build configuration list for PBXNativeTarget "Lesson 9" */ = { 335 | isa = XCConfigurationList; 336 | buildConfigurations = ( 337 | 1D34827023E206A600694D62 /* Debug */, 338 | 1D34827123E206A600694D62 /* Release */, 339 | ); 340 | defaultConfigurationIsVisible = 0; 341 | defaultConfigurationName = Release; 342 | }; 343 | /* End XCConfigurationList section */ 344 | }; 345 | rootObject = 1D34825923E206A400694D62 /* Project object */; 346 | } 347 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9.xcodeproj/xcshareddata/xcschemes/Lesson 9.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Lesson 9 4 | // 5 | // Created by Lucas Derraugh on 1/29/20. 6 | // Copyright © 2020 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | 14 | @IBOutlet weak var window: NSWindow! 15 | 16 | 17 | func applicationDidFinishLaunching(_ aNotification: Notification) { 18 | window.contentViewController = PictureCollectionViewController() 19 | } 20 | 21 | func applicationWillTerminate(_ aNotification: Notification) { 22 | // Insert code here to tear down your application 23 | } 24 | 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /Lesson 9/Lesson 9/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Lesson 9/Lesson 9/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | Copyright © 2020 Lucas Derraugh. All rights reserved. 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | NSSupportsAutomaticTermination 32 | 33 | NSSupportsSuddenTermination 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9/Lesson_9.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9/PictureCollectionViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PictureCollectionViewController.swift 3 | // Lesson 9 4 | // 5 | // Created by Lucas Derraugh on 1/29/20. 6 | // Copyright © 2020 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class PictureCollectionViewController: NSViewController { 12 | 13 | @IBOutlet weak var collectionView: NSCollectionView! 14 | 15 | private var dataSource: NSCollectionViewDiffableDataSource! 16 | private var imageURLs = [URL]() 17 | 18 | lazy var queue = DispatchQueue(label: "com.lucas.ImageRequestingQueue", qos: .userInitiated, attributes: [.concurrent]) 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | 23 | collectionView.register(PictureCollectionViewItem.self, forItemWithIdentifier: PictureCollectionViewItem.reuseIdentifier) 24 | collectionView.collectionViewLayout = createLayout() 25 | 26 | setupDataSource() 27 | } 28 | 29 | private func createLayout() -> NSCollectionViewLayout { 30 | let sectionProvider = { (sectionIndex: Int, layoutEnvironment: NSCollectionLayoutEnvironment) -> NSCollectionLayoutSection in 31 | let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), 32 | heightDimension: .fractionalHeight(1)) 33 | let item = NSCollectionLayoutItem(layoutSize: itemSize) 34 | let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), 35 | heightDimension: .absolute(300)) 36 | let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitem: item, count: 4) 37 | 38 | let section = NSCollectionLayoutSection(group: group) 39 | section.contentInsets = NSDirectionalEdgeInsets(top: 10, leading: 10, bottom: 10, trailing: 10) 40 | 41 | return section 42 | } 43 | 44 | let layout = NSCollectionViewCompositionalLayout(sectionProvider: sectionProvider) 45 | return layout 46 | } 47 | 48 | private func setupDataSource() { 49 | let directory = URL(fileURLWithPath: "/System/Library/Desktop Pictures") 50 | guard let enumerator = FileManager.default.enumerator(at: directory, includingPropertiesForKeys: [.typeIdentifierKey]) else { return } 51 | for case let url as URL in enumerator { 52 | guard let type = try? url.resourceValues(forKeys: [.typeIdentifierKey]).typeIdentifier else { continue } 53 | let identifier = type as CFString 54 | if UTTypeConformsTo(identifier, kUTTypeImage) { 55 | imageURLs.append(url) 56 | } 57 | } 58 | 59 | dataSource = NSCollectionViewDiffableDataSource(collectionView: collectionView) { [weak self] (collectionView, indexPath, url) -> NSCollectionViewItem? in 60 | let collectionViewItem = collectionView.makeItem(withIdentifier: PictureCollectionViewItem.reuseIdentifier, for: indexPath) 61 | guard let self = self, let imageView = collectionViewItem.imageView else { return nil } 62 | let newTag = imageView.tag + 1 63 | collectionViewItem.imageView?.tag = newTag 64 | self.queue.async { 65 | let image = resizedImage(at: url, for: CGSize(width: 400, height: 300)) 66 | DispatchQueue.main.async { 67 | if newTag == imageView.tag { 68 | imageView.image = image 69 | } 70 | } 71 | } 72 | return collectionViewItem 73 | } 74 | 75 | var snapshot = NSDiffableDataSourceSnapshot() 76 | 77 | snapshot.appendSections([0]) 78 | snapshot.appendItems(imageURLs, toSection: 0) 79 | 80 | dataSource.apply(snapshot, animatingDifferences: true) 81 | } 82 | } 83 | 84 | // https://nshipster.com/image-resizing/#technique-3-creating-a-thumbnail-with-image-io 85 | fileprivate func resizedImage(at url: URL, for size: CGSize) -> NSImage? { 86 | let options: [CFString: Any] = [ 87 | kCGImageSourceCreateThumbnailFromImageIfAbsent: true, 88 | kCGImageSourceCreateThumbnailWithTransform: true, 89 | kCGImageSourceShouldCacheImmediately: true, 90 | kCGImageSourceThumbnailMaxPixelSize: max(size.width, size.height) 91 | ] 92 | 93 | guard let imageSource = CGImageSourceCreateWithURL(url as NSURL, nil), 94 | let image = CGImageSourceCreateThumbnailAtIndex(imageSource, 0, options as CFDictionary) 95 | else { 96 | return nil 97 | } 98 | 99 | return NSImage(cgImage: image, size: size) 100 | } 101 | 102 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9/PictureCollectionViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9/PictureCollectionViewItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PictureCollectionViewItem.swift 3 | // Lesson 9 4 | // 5 | // Created by Lucas Derraugh on 1/29/20. 6 | // Copyright © 2020 Lucas Derraugh. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | final class PictureCollectionViewItem: NSCollectionViewItem { 12 | 13 | static let reuseIdentifier = NSUserInterfaceItemIdentifier("SystemIconCollectionViewItemIdentifier") 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | // Do view setup here. 18 | } 19 | 20 | override func prepareForReuse() { 21 | super.prepareForReuse() 22 | imageView?.image = nil 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /Lesson 9/Lesson 9/PictureCollectionViewItem.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | --------------------------------------------------------------------------------