├── .DS_Store ├── .gitignore ├── Ducking.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── Ducking ├── AppDelegate.swift ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ └── Duck.imageset │ │ ├── Contents.json │ │ └── Image.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SceneDelegate.swift ├── ViewController.swift └── quack.mp3 ├── LICENSE └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerhall/ducking/13783210b5e9f8948dfc1f4d0a573eb85139fc02/.DS_Store -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /Ducking.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C676DE292705392E0091B6DB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C676DE282705392E0091B6DB /* AppDelegate.swift */; }; 11 | C676DE2B2705392E0091B6DB /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C676DE2A2705392E0091B6DB /* SceneDelegate.swift */; }; 12 | C676DE2D2705392E0091B6DB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C676DE2C2705392E0091B6DB /* ViewController.swift */; }; 13 | C676DE302705392E0091B6DB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C676DE2E2705392E0091B6DB /* Main.storyboard */; }; 14 | C676DE322705392F0091B6DB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C676DE312705392F0091B6DB /* Assets.xcassets */; }; 15 | C676DE352705392F0091B6DB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C676DE332705392F0091B6DB /* LaunchScreen.storyboard */; }; 16 | C676DE3D2705524D0091B6DB /* quack.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C676DE3C2705524D0091B6DB /* quack.mp3 */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | C676DE252705392E0091B6DB /* Ducking.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Ducking.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | C676DE282705392E0091B6DB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | C676DE2A2705392E0091B6DB /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 23 | C676DE2C2705392E0091B6DB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | C676DE2F2705392E0091B6DB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | C676DE312705392F0091B6DB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | C676DE342705392F0091B6DB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | C676DE362705392F0091B6DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | C676DE3C2705524D0091B6DB /* quack.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = quack.mp3; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | C676DE222705392E0091B6DB /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | C676DE1C2705392E0091B6DB = { 43 | isa = PBXGroup; 44 | children = ( 45 | C676DE272705392E0091B6DB /* Ducking */, 46 | C676DE262705392E0091B6DB /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | C676DE262705392E0091B6DB /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | C676DE252705392E0091B6DB /* Ducking.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | C676DE272705392E0091B6DB /* Ducking */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | C676DE282705392E0091B6DB /* AppDelegate.swift */, 62 | C676DE2A2705392E0091B6DB /* SceneDelegate.swift */, 63 | C676DE2C2705392E0091B6DB /* ViewController.swift */, 64 | C676DE2E2705392E0091B6DB /* Main.storyboard */, 65 | C676DE312705392F0091B6DB /* Assets.xcassets */, 66 | C676DE332705392F0091B6DB /* LaunchScreen.storyboard */, 67 | C676DE362705392F0091B6DB /* Info.plist */, 68 | C676DE3C2705524D0091B6DB /* quack.mp3 */, 69 | ); 70 | path = Ducking; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | C676DE242705392E0091B6DB /* Ducking */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = C676DE392705392F0091B6DB /* Build configuration list for PBXNativeTarget "Ducking" */; 79 | buildPhases = ( 80 | C676DE212705392E0091B6DB /* Sources */, 81 | C676DE222705392E0091B6DB /* Frameworks */, 82 | C676DE232705392E0091B6DB /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = Ducking; 89 | productName = Ducking; 90 | productReference = C676DE252705392E0091B6DB /* Ducking.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | C676DE1D2705392E0091B6DB /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | BuildIndependentTargetsInParallel = 1; 100 | LastSwiftUpdateCheck = 1300; 101 | LastUpgradeCheck = 1300; 102 | TargetAttributes = { 103 | C676DE242705392E0091B6DB = { 104 | CreatedOnToolsVersion = 13.0; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = C676DE202705392E0091B6DB /* Build configuration list for PBXProject "Ducking" */; 109 | compatibilityVersion = "Xcode 13.0"; 110 | developmentRegion = en; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = C676DE1C2705392E0091B6DB; 117 | productRefGroup = C676DE262705392E0091B6DB /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | C676DE242705392E0091B6DB /* Ducking */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | C676DE232705392E0091B6DB /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | C676DE3D2705524D0091B6DB /* quack.mp3 in Resources */, 132 | C676DE352705392F0091B6DB /* LaunchScreen.storyboard in Resources */, 133 | C676DE322705392F0091B6DB /* Assets.xcassets in Resources */, 134 | C676DE302705392E0091B6DB /* Main.storyboard in Resources */, 135 | ); 136 | runOnlyForDeploymentPostprocessing = 0; 137 | }; 138 | /* End PBXResourcesBuildPhase section */ 139 | 140 | /* Begin PBXSourcesBuildPhase section */ 141 | C676DE212705392E0091B6DB /* Sources */ = { 142 | isa = PBXSourcesBuildPhase; 143 | buildActionMask = 2147483647; 144 | files = ( 145 | C676DE2D2705392E0091B6DB /* ViewController.swift in Sources */, 146 | C676DE292705392E0091B6DB /* AppDelegate.swift in Sources */, 147 | C676DE2B2705392E0091B6DB /* SceneDelegate.swift in Sources */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXSourcesBuildPhase section */ 152 | 153 | /* Begin PBXVariantGroup section */ 154 | C676DE2E2705392E0091B6DB /* Main.storyboard */ = { 155 | isa = PBXVariantGroup; 156 | children = ( 157 | C676DE2F2705392E0091B6DB /* Base */, 158 | ); 159 | name = Main.storyboard; 160 | sourceTree = ""; 161 | }; 162 | C676DE332705392F0091B6DB /* LaunchScreen.storyboard */ = { 163 | isa = PBXVariantGroup; 164 | children = ( 165 | C676DE342705392F0091B6DB /* Base */, 166 | ); 167 | name = LaunchScreen.storyboard; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXVariantGroup section */ 171 | 172 | /* Begin XCBuildConfiguration section */ 173 | C676DE372705392F0091B6DB /* Debug */ = { 174 | isa = XCBuildConfiguration; 175 | buildSettings = { 176 | ALWAYS_SEARCH_USER_PATHS = NO; 177 | CLANG_ANALYZER_NONNULL = YES; 178 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 180 | CLANG_CXX_LIBRARY = "libc++"; 181 | CLANG_ENABLE_MODULES = YES; 182 | CLANG_ENABLE_OBJC_ARC = YES; 183 | CLANG_ENABLE_OBJC_WEAK = YES; 184 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_COMMA = YES; 187 | CLANG_WARN_CONSTANT_CONVERSION = YES; 188 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 190 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 191 | CLANG_WARN_EMPTY_BODY = YES; 192 | CLANG_WARN_ENUM_CONVERSION = YES; 193 | CLANG_WARN_INFINITE_RECURSION = YES; 194 | CLANG_WARN_INT_CONVERSION = YES; 195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 196 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 197 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 199 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 200 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 201 | CLANG_WARN_STRICT_PROTOTYPES = YES; 202 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 203 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 204 | CLANG_WARN_UNREACHABLE_CODE = YES; 205 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 206 | COPY_PHASE_STRIP = NO; 207 | DEBUG_INFORMATION_FORMAT = dwarf; 208 | ENABLE_STRICT_OBJC_MSGSEND = YES; 209 | ENABLE_TESTABILITY = YES; 210 | GCC_C_LANGUAGE_STANDARD = gnu11; 211 | GCC_DYNAMIC_NO_PIC = NO; 212 | GCC_NO_COMMON_BLOCKS = YES; 213 | GCC_OPTIMIZATION_LEVEL = 0; 214 | GCC_PREPROCESSOR_DEFINITIONS = ( 215 | "DEBUG=1", 216 | "$(inherited)", 217 | ); 218 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 219 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 220 | GCC_WARN_UNDECLARED_SELECTOR = YES; 221 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 222 | GCC_WARN_UNUSED_FUNCTION = YES; 223 | GCC_WARN_UNUSED_VARIABLE = YES; 224 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 225 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 226 | MTL_FAST_MATH = YES; 227 | ONLY_ACTIVE_ARCH = YES; 228 | SDKROOT = iphoneos; 229 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 230 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 231 | }; 232 | name = Debug; 233 | }; 234 | C676DE382705392F0091B6DB /* Release */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ANALYZER_NONNULL = YES; 239 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 240 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 241 | CLANG_CXX_LIBRARY = "libc++"; 242 | CLANG_ENABLE_MODULES = YES; 243 | CLANG_ENABLE_OBJC_ARC = YES; 244 | CLANG_ENABLE_OBJC_WEAK = YES; 245 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_COMMA = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 250 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 251 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 252 | CLANG_WARN_EMPTY_BODY = YES; 253 | CLANG_WARN_ENUM_CONVERSION = YES; 254 | CLANG_WARN_INFINITE_RECURSION = YES; 255 | CLANG_WARN_INT_CONVERSION = YES; 256 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 257 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 258 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 259 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 260 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 261 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 262 | CLANG_WARN_STRICT_PROTOTYPES = YES; 263 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 264 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 265 | CLANG_WARN_UNREACHABLE_CODE = YES; 266 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 267 | COPY_PHASE_STRIP = NO; 268 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 269 | ENABLE_NS_ASSERTIONS = NO; 270 | ENABLE_STRICT_OBJC_MSGSEND = YES; 271 | GCC_C_LANGUAGE_STANDARD = gnu11; 272 | GCC_NO_COMMON_BLOCKS = YES; 273 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 274 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 275 | GCC_WARN_UNDECLARED_SELECTOR = YES; 276 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 277 | GCC_WARN_UNUSED_FUNCTION = YES; 278 | GCC_WARN_UNUSED_VARIABLE = YES; 279 | IPHONEOS_DEPLOYMENT_TARGET = 15.0; 280 | MTL_ENABLE_DEBUG_INFO = NO; 281 | MTL_FAST_MATH = YES; 282 | SDKROOT = iphoneos; 283 | SWIFT_COMPILATION_MODE = wholemodule; 284 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 285 | VALIDATE_PRODUCT = YES; 286 | }; 287 | name = Release; 288 | }; 289 | C676DE3A2705392F0091B6DB /* Debug */ = { 290 | isa = XCBuildConfiguration; 291 | buildSettings = { 292 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 293 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 294 | CODE_SIGN_STYLE = Automatic; 295 | CURRENT_PROJECT_VERSION = 1; 296 | DEVELOPMENT_TEAM = 3A6K89K388; 297 | GENERATE_INFOPLIST_FILE = YES; 298 | INFOPLIST_FILE = Ducking/Info.plist; 299 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 300 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 301 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 302 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 303 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 304 | LD_RUNPATH_SEARCH_PATHS = ( 305 | "$(inherited)", 306 | "@executable_path/Frameworks", 307 | ); 308 | MARKETING_VERSION = 1.0; 309 | PRODUCT_BUNDLE_IDENTIFIER = iot.tyler.Ducking; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | SWIFT_EMIT_LOC_STRINGS = YES; 312 | SWIFT_VERSION = 5.0; 313 | TARGETED_DEVICE_FAMILY = "1,2"; 314 | }; 315 | name = Debug; 316 | }; 317 | C676DE3B2705392F0091B6DB /* Release */ = { 318 | isa = XCBuildConfiguration; 319 | buildSettings = { 320 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 321 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 322 | CODE_SIGN_STYLE = Automatic; 323 | CURRENT_PROJECT_VERSION = 1; 324 | DEVELOPMENT_TEAM = 3A6K89K388; 325 | GENERATE_INFOPLIST_FILE = YES; 326 | INFOPLIST_FILE = Ducking/Info.plist; 327 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 328 | INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; 329 | INFOPLIST_KEY_UIMainStoryboardFile = Main; 330 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 331 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 332 | LD_RUNPATH_SEARCH_PATHS = ( 333 | "$(inherited)", 334 | "@executable_path/Frameworks", 335 | ); 336 | MARKETING_VERSION = 1.0; 337 | PRODUCT_BUNDLE_IDENTIFIER = iot.tyler.Ducking; 338 | PRODUCT_NAME = "$(TARGET_NAME)"; 339 | SWIFT_EMIT_LOC_STRINGS = YES; 340 | SWIFT_VERSION = 5.0; 341 | TARGETED_DEVICE_FAMILY = "1,2"; 342 | }; 343 | name = Release; 344 | }; 345 | /* End XCBuildConfiguration section */ 346 | 347 | /* Begin XCConfigurationList section */ 348 | C676DE202705392E0091B6DB /* Build configuration list for PBXProject "Ducking" */ = { 349 | isa = XCConfigurationList; 350 | buildConfigurations = ( 351 | C676DE372705392F0091B6DB /* Debug */, 352 | C676DE382705392F0091B6DB /* Release */, 353 | ); 354 | defaultConfigurationIsVisible = 0; 355 | defaultConfigurationName = Release; 356 | }; 357 | C676DE392705392F0091B6DB /* Build configuration list for PBXNativeTarget "Ducking" */ = { 358 | isa = XCConfigurationList; 359 | buildConfigurations = ( 360 | C676DE3A2705392F0091B6DB /* Debug */, 361 | C676DE3B2705392F0091B6DB /* Release */, 362 | ); 363 | defaultConfigurationIsVisible = 0; 364 | defaultConfigurationName = Release; 365 | }; 366 | /* End XCConfigurationList section */ 367 | }; 368 | rootObject = C676DE1D2705392E0091B6DB /* Project object */; 369 | } 370 | -------------------------------------------------------------------------------- /Ducking.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ducking.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Ducking/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Ducking 4 | // 5 | // Created by Tyler Hall on 9/29/21. 6 | // 7 | 8 | import UIKit 9 | 10 | @main 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 | // Override point for customization after application launch. 17 | return true 18 | } 19 | 20 | // MARK: UISceneSession Lifecycle 21 | 22 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 23 | // Called when a new scene session is being created. 24 | // Use this method to select a configuration to create the new scene with. 25 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 26 | } 27 | 28 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 29 | // Called when the user discards a scene session. 30 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 31 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 32 | } 33 | 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Ducking/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Ducking/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Ducking/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Ducking/Assets.xcassets/Duck.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Ducking/Assets.xcassets/Duck.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerhall/ducking/13783210b5e9f8948dfc1f4d0a573eb85139fc02/Ducking/Assets.xcassets/Duck.imageset/Image.png -------------------------------------------------------------------------------- /Ducking/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Ducking/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Ducking/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIApplicationSceneManifest 6 | 7 | UIApplicationSupportsMultipleScenes 8 | 9 | UISceneConfigurations 10 | 11 | UIWindowSceneSessionRoleApplication 12 | 13 | 14 | UISceneConfigurationName 15 | Default Configuration 16 | UISceneDelegateClassName 17 | $(PRODUCT_MODULE_NAME).SceneDelegate 18 | UISceneStoryboardFile 19 | Main 20 | 21 | 22 | 23 | 24 | NSCameraUsageDescription 25 | This app uses the camera to filter visual profanity. 26 | 27 | 28 | -------------------------------------------------------------------------------- /Ducking/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // Ducking 4 | // 5 | // Created by Tyler Hall on 9/29/21. 6 | // 7 | 8 | import UIKit 9 | 10 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 11 | 12 | var window: UIWindow? 13 | 14 | 15 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 16 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 17 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 18 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 19 | guard let _ = (scene as? UIWindowScene) else { return } 20 | } 21 | 22 | func sceneDidDisconnect(_ scene: UIScene) { 23 | // Called as the scene is being released by the system. 24 | // This occurs shortly after the scene enters the background, or when its session is discarded. 25 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 26 | // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). 27 | } 28 | 29 | func sceneDidBecomeActive(_ scene: UIScene) { 30 | // Called when the scene has moved from an inactive state to an active state. 31 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 32 | } 33 | 34 | func sceneWillResignActive(_ scene: UIScene) { 35 | // Called when the scene will move from an active state to an inactive state. 36 | // This may occur due to temporary interruptions (ex. an incoming phone call). 37 | } 38 | 39 | func sceneWillEnterForeground(_ scene: UIScene) { 40 | // Called as the scene transitions from the background to the foreground. 41 | // Use this method to undo the changes made on entering the background. 42 | } 43 | 44 | func sceneDidEnterBackground(_ scene: UIScene) { 45 | // Called as the scene transitions from the foreground to the background. 46 | // Use this method to save data, release shared resources, and store enough scene-specific state information 47 | // to restore the scene back to its current state. 48 | } 49 | 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /Ducking/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Ducking 4 | // 5 | // Created by Tyler Hall on 9/29/21. 6 | // 7 | 8 | import UIKit 9 | import ARKit 10 | import Vision 11 | 12 | class ViewController: UIViewController { 13 | 14 | @IBOutlet weak var sceneView: ARSCNView! 15 | @IBOutlet weak var duckView: DuckView! 16 | 17 | let config = ARWorldTrackingConfiguration() 18 | var coachingOverlay = ARCoachingOverlayView() 19 | 20 | var isRecognizing = false 21 | 22 | var missingCount = 0 23 | 24 | override func viewDidLoad() { 25 | super.viewDidLoad() 26 | 27 | sceneView.session.run(config, options: []) 28 | sceneView.session.delegate = self 29 | sceneView.delegate = self 30 | sceneView.autoenablesDefaultLighting = true 31 | } 32 | } 33 | 34 | extension ViewController: ARSessionDelegate { 35 | 36 | } 37 | 38 | extension ViewController: ARSCNViewDelegate { 39 | 40 | func session(_ session: ARSession, didUpdate frame: ARFrame) { 41 | 42 | func nope() { 43 | isRecognizing = false 44 | } 45 | 46 | guard !isRecognizing else { return } 47 | isRecognizing = true 48 | 49 | guard let cvPixelBuffer = sceneView.session.currentFrame?.capturedImage else { nope(); return } 50 | 51 | let width = self.sceneView.bounds.size.width 52 | let height = self.sceneView.bounds.size.height 53 | 54 | DispatchQueue.global(qos: .userInteractive).async { [weak self] in 55 | guard let self = self else { return } 56 | 57 | var info = CMSampleTimingInfo() 58 | info.presentationTimeStamp = CMTime.zero 59 | info.duration = CMTime.invalid 60 | info.decodeTimeStamp = CMTime.invalid 61 | 62 | var formatDesc: CMFormatDescription? = nil 63 | CMVideoFormatDescriptionCreateForImageBuffer(allocator: kCFAllocatorDefault, imageBuffer: cvPixelBuffer, formatDescriptionOut: &formatDesc) 64 | var sampleBuffer: CMSampleBuffer? = nil 65 | 66 | CMSampleBufferCreateReadyWithImageBuffer(allocator: kCFAllocatorDefault, imageBuffer: cvPixelBuffer, formatDescription: formatDesc!, sampleTiming: &info, sampleBufferOut: &sampleBuffer) 67 | 68 | guard let sampleBuffer = sampleBuffer else { nope(); return } 69 | 70 | let handler = VNImageRequestHandler(cmSampleBuffer: sampleBuffer, orientation: .right, options: [:]) 71 | 72 | let handPoseRequest = VNDetectHumanHandPoseRequest() 73 | handPoseRequest.maximumHandCount = 2 74 | 75 | try? handler.perform([handPoseRequest]) 76 | 77 | var points = [CGPoint]() 78 | for observation in (handPoseRequest.results ?? []) { 79 | guard let middlePoints = try? observation.recognizedPoints(.middleFinger) else { continue } 80 | guard let indexPoints = try? observation.recognizedPoints(.indexFinger) else { continue } 81 | 82 | guard let middleTipY = middlePoints[.middleTip]?.location.y else { continue } 83 | guard let middlePipY = middlePoints[.middlePIP]?.location.y else { continue } 84 | 85 | guard let indexTipY = indexPoints[.indexTip]?.location.y else { continue } 86 | guard let indexPipY = indexPoints[.indexPIP]?.location.y else { continue } 87 | 88 | let a = (middlePipY < middleTipY) 89 | let b = (indexPipY < indexTipY) 90 | 91 | guard a != b else { continue } 92 | 93 | guard let middleTipX = middlePoints[.middleTip]?.location.x else { continue } 94 | 95 | let vx = CGFloat(width) * middleTipX 96 | let vy = CGFloat(height) * (1 - middleTipY) 97 | 98 | points.append(CGPoint(x: vx, y: vy)) 99 | } 100 | 101 | DispatchQueue.main.async { [weak self] in 102 | self?.duckView.setDuck1(point: points[safe: 0]) 103 | self?.duckView.setDuck2(point: points[safe: 1]) 104 | self?.isRecognizing = false 105 | } 106 | } 107 | } 108 | } 109 | 110 | class DuckView: UIView { 111 | 112 | let size: CGFloat = 200 113 | 114 | let duck1 = UIImageView(image: UIImage(named: "Duck")) 115 | let duck2 = UIImageView(image: UIImage(named: "Duck")) 116 | 117 | var duck1Timer: Timer? 118 | var duck2Timer: Timer? 119 | 120 | var player: AVAudioPlayer? 121 | 122 | required init?(coder: NSCoder) { 123 | super.init(coder: coder) 124 | backgroundColor = .clear 125 | 126 | duck1.isHidden = true 127 | duck2.isHidden = true 128 | 129 | addSubview(duck1) 130 | addSubview(duck2) 131 | 132 | player = try? AVAudioPlayer(contentsOf: Bundle.main.url(forResource: "quack", withExtension: "mp3")!) 133 | player?.prepareToPlay() 134 | } 135 | 136 | func setDuck1(point: CGPoint?) { 137 | if let point = point { 138 | duck1Timer?.invalidate() 139 | duck1Timer = nil 140 | 141 | duck1.frame = CGRect(x: point.x - (size / 2), y: point.y - (size / 2), width: size, height: size) 142 | 143 | if duck1.isHidden { 144 | player?.play() 145 | } 146 | 147 | duck1.isHidden = false 148 | } else { 149 | if duck1Timer == nil { 150 | duck1Timer = Timer.scheduledTimer(withTimeInterval: 0.3, repeats: false, block: { [weak self] _ in 151 | self?.duck1.isHidden = true 152 | }) 153 | } 154 | } 155 | } 156 | 157 | func setDuck2(point: CGPoint?) { 158 | if let point = point { 159 | duck2Timer?.invalidate() 160 | duck2Timer = nil 161 | 162 | duck2.frame = CGRect(x: point.x - (size / 2), y: point.y - (size / 2), width: size, height: size) 163 | 164 | if duck2.isHidden { 165 | player?.play() 166 | } 167 | 168 | duck2.isHidden = false 169 | } else { 170 | if duck2Timer == nil { 171 | duck2Timer = Timer.scheduledTimer(withTimeInterval: 0.3, repeats: false, block: { [weak self] _ in 172 | self?.duck2.isHidden = true 173 | }) 174 | } 175 | } 176 | } 177 | } 178 | 179 | extension Collection { 180 | subscript (safe index: Index) -> Element? { 181 | return indices.contains(index) ? self[index] : nil 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /Ducking/quack.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tylerhall/ducking/13783210b5e9f8948dfc1f4d0a573eb85139fc02/Ducking/quack.mp3 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Tyler Hall 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ducking 2 | 3 | [Read this](https://tyler.io/augmented-reality-ducks/) 4 | --------------------------------------------------------------------------------