├── .gitignore ├── DragAndDropDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── xcuserdata │ └── a13931.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── DragAndDropDemo ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── afro_hair.imageset │ │ ├── Contents.json │ │ ├── afro_hair.png │ │ └── afro_hair@2x.png │ ├── base_profile.imageset │ │ ├── Contents.json │ │ ├── base_profile.png │ │ └── base_profile@2x.png │ └── mask.imageset │ │ ├── Contents.json │ │ ├── mask.png │ │ └── mask@2x.png ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController+Drag.swift ├── ViewController+Drop.swift └── ViewController.swift ├── DragAndDropDemoTests ├── DragAndDropDemoTests.swift └── Info.plist └── DragAndDropDemoUITests ├── DragAndDropDemoUITests.swift └── Info.plist /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | .DS_Store 6 | ## Build generated 7 | build/ 8 | DerivedData/ 9 | 10 | ## Various settings 11 | *.pbxuser 12 | !default.pbxuser 13 | *.mode1v3 14 | !default.mode1v3 15 | *.mode2v3 16 | !default.mode2v3 17 | *.perspectivev3 18 | !default.perspectivev3 19 | xcuserdata/ 20 | 21 | ## Other 22 | *.moved-aside 23 | *.xcuserstate 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | # Swift Package Manager 32 | # 33 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 34 | # Packages/ 35 | .build/ 36 | 37 | # CocoaPods 38 | # 39 | # We recommend against adding the Pods directory to your .gitignore. However 40 | # you should judge for yourself, the pros and cons are mentioned at: 41 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 42 | # 43 | # Pods/ 44 | 45 | # Carthage 46 | # 47 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 48 | # Carthage/Checkouts 49 | 50 | Carthage/Build -------------------------------------------------------------------------------- /DragAndDropDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | FF43C7591EF637BF009138CA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF43C7581EF637BF009138CA /* AppDelegate.swift */; }; 11 | FF43C75B1EF637BF009138CA /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF43C75A1EF637BF009138CA /* ViewController.swift */; }; 12 | FF43C75E1EF637BF009138CA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FF43C75C1EF637BF009138CA /* Main.storyboard */; }; 13 | FF43C7601EF637BF009138CA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FF43C75F1EF637BF009138CA /* Assets.xcassets */; }; 14 | FF43C7631EF637BF009138CA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FF43C7611EF637BF009138CA /* LaunchScreen.storyboard */; }; 15 | FF43C76E1EF637BF009138CA /* DragAndDropDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF43C76D1EF637BF009138CA /* DragAndDropDemoTests.swift */; }; 16 | FF43C7791EF637BF009138CA /* DragAndDropDemoUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF43C7781EF637BF009138CA /* DragAndDropDemoUITests.swift */; }; 17 | FF43C7881EF64456009138CA /* ViewController+Drag.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF43C7871EF64456009138CA /* ViewController+Drag.swift */; }; 18 | FF97071B1EF6482A0024365D /* ViewController+Drop.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF97071A1EF6482A0024365D /* ViewController+Drop.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | FF43C76A1EF637BF009138CA /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = FF43C74D1EF637BE009138CA /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = FF43C7541EF637BE009138CA; 27 | remoteInfo = DragAndDropDemo; 28 | }; 29 | FF43C7751EF637BF009138CA /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = FF43C74D1EF637BE009138CA /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = FF43C7541EF637BE009138CA; 34 | remoteInfo = DragAndDropDemo; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | FF43C7551EF637BE009138CA /* DragAndDropDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DragAndDropDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | FF43C7581EF637BF009138CA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 41 | FF43C75A1EF637BF009138CA /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 42 | FF43C75D1EF637BF009138CA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 43 | FF43C75F1EF637BF009138CA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 44 | FF43C7621EF637BF009138CA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 45 | FF43C7641EF637BF009138CA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 46 | FF43C7691EF637BF009138CA /* DragAndDropDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DragAndDropDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | FF43C76D1EF637BF009138CA /* DragAndDropDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DragAndDropDemoTests.swift; sourceTree = ""; }; 48 | FF43C76F1EF637BF009138CA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | FF43C7741EF637BF009138CA /* DragAndDropDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DragAndDropDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | FF43C7781EF637BF009138CA /* DragAndDropDemoUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DragAndDropDemoUITests.swift; sourceTree = ""; }; 51 | FF43C77A1EF637BF009138CA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | FF43C7871EF64456009138CA /* ViewController+Drag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewController+Drag.swift"; sourceTree = ""; }; 53 | FF97071A1EF6482A0024365D /* ViewController+Drop.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewController+Drop.swift"; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | FF43C7521EF637BE009138CA /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | FF43C7661EF637BF009138CA /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | FF43C7711EF637BF009138CA /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | FF43C74C1EF637BE009138CA = { 82 | isa = PBXGroup; 83 | children = ( 84 | FF43C7571EF637BE009138CA /* DragAndDropDemo */, 85 | FF43C76C1EF637BF009138CA /* DragAndDropDemoTests */, 86 | FF43C7771EF637BF009138CA /* DragAndDropDemoUITests */, 87 | FF43C7561EF637BE009138CA /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | FF43C7561EF637BE009138CA /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | FF43C7551EF637BE009138CA /* DragAndDropDemo.app */, 95 | FF43C7691EF637BF009138CA /* DragAndDropDemoTests.xctest */, 96 | FF43C7741EF637BF009138CA /* DragAndDropDemoUITests.xctest */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | FF43C7571EF637BE009138CA /* DragAndDropDemo */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | FF43C7581EF637BF009138CA /* AppDelegate.swift */, 105 | FF43C75A1EF637BF009138CA /* ViewController.swift */, 106 | FF43C7871EF64456009138CA /* ViewController+Drag.swift */, 107 | FF97071A1EF6482A0024365D /* ViewController+Drop.swift */, 108 | FF43C7861EF638D2009138CA /* Resources */, 109 | ); 110 | path = DragAndDropDemo; 111 | sourceTree = ""; 112 | }; 113 | FF43C76C1EF637BF009138CA /* DragAndDropDemoTests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | FF43C76D1EF637BF009138CA /* DragAndDropDemoTests.swift */, 117 | FF43C76F1EF637BF009138CA /* Info.plist */, 118 | ); 119 | path = DragAndDropDemoTests; 120 | sourceTree = ""; 121 | }; 122 | FF43C7771EF637BF009138CA /* DragAndDropDemoUITests */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | FF43C7781EF637BF009138CA /* DragAndDropDemoUITests.swift */, 126 | FF43C77A1EF637BF009138CA /* Info.plist */, 127 | ); 128 | path = DragAndDropDemoUITests; 129 | sourceTree = ""; 130 | }; 131 | FF43C7861EF638D2009138CA /* Resources */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | FF43C75C1EF637BF009138CA /* Main.storyboard */, 135 | FF43C75F1EF637BF009138CA /* Assets.xcassets */, 136 | FF43C7611EF637BF009138CA /* LaunchScreen.storyboard */, 137 | FF43C7641EF637BF009138CA /* Info.plist */, 138 | ); 139 | name = Resources; 140 | sourceTree = ""; 141 | }; 142 | /* End PBXGroup section */ 143 | 144 | /* Begin PBXNativeTarget section */ 145 | FF43C7541EF637BE009138CA /* DragAndDropDemo */ = { 146 | isa = PBXNativeTarget; 147 | buildConfigurationList = FF43C77D1EF637BF009138CA /* Build configuration list for PBXNativeTarget "DragAndDropDemo" */; 148 | buildPhases = ( 149 | FF43C7511EF637BE009138CA /* Sources */, 150 | FF43C7521EF637BE009138CA /* Frameworks */, 151 | FF43C7531EF637BE009138CA /* Resources */, 152 | ); 153 | buildRules = ( 154 | ); 155 | dependencies = ( 156 | ); 157 | name = DragAndDropDemo; 158 | productName = DragAndDropDemo; 159 | productReference = FF43C7551EF637BE009138CA /* DragAndDropDemo.app */; 160 | productType = "com.apple.product-type.application"; 161 | }; 162 | FF43C7681EF637BF009138CA /* DragAndDropDemoTests */ = { 163 | isa = PBXNativeTarget; 164 | buildConfigurationList = FF43C7801EF637BF009138CA /* Build configuration list for PBXNativeTarget "DragAndDropDemoTests" */; 165 | buildPhases = ( 166 | FF43C7651EF637BF009138CA /* Sources */, 167 | FF43C7661EF637BF009138CA /* Frameworks */, 168 | FF43C7671EF637BF009138CA /* Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | FF43C76B1EF637BF009138CA /* PBXTargetDependency */, 174 | ); 175 | name = DragAndDropDemoTests; 176 | productName = DragAndDropDemoTests; 177 | productReference = FF43C7691EF637BF009138CA /* DragAndDropDemoTests.xctest */; 178 | productType = "com.apple.product-type.bundle.unit-test"; 179 | }; 180 | FF43C7731EF637BF009138CA /* DragAndDropDemoUITests */ = { 181 | isa = PBXNativeTarget; 182 | buildConfigurationList = FF43C7831EF637BF009138CA /* Build configuration list for PBXNativeTarget "DragAndDropDemoUITests" */; 183 | buildPhases = ( 184 | FF43C7701EF637BF009138CA /* Sources */, 185 | FF43C7711EF637BF009138CA /* Frameworks */, 186 | FF43C7721EF637BF009138CA /* Resources */, 187 | ); 188 | buildRules = ( 189 | ); 190 | dependencies = ( 191 | FF43C7761EF637BF009138CA /* PBXTargetDependency */, 192 | ); 193 | name = DragAndDropDemoUITests; 194 | productName = DragAndDropDemoUITests; 195 | productReference = FF43C7741EF637BF009138CA /* DragAndDropDemoUITests.xctest */; 196 | productType = "com.apple.product-type.bundle.ui-testing"; 197 | }; 198 | /* End PBXNativeTarget section */ 199 | 200 | /* Begin PBXProject section */ 201 | FF43C74D1EF637BE009138CA /* Project object */ = { 202 | isa = PBXProject; 203 | attributes = { 204 | LastSwiftUpdateCheck = 0900; 205 | LastUpgradeCheck = 0900; 206 | ORGANIZATIONNAME = "辰己 佳祐"; 207 | TargetAttributes = { 208 | FF43C7541EF637BE009138CA = { 209 | CreatedOnToolsVersion = 9.0; 210 | }; 211 | FF43C7681EF637BF009138CA = { 212 | CreatedOnToolsVersion = 9.0; 213 | TestTargetID = FF43C7541EF637BE009138CA; 214 | }; 215 | FF43C7731EF637BF009138CA = { 216 | CreatedOnToolsVersion = 9.0; 217 | TestTargetID = FF43C7541EF637BE009138CA; 218 | }; 219 | }; 220 | }; 221 | buildConfigurationList = FF43C7501EF637BE009138CA /* Build configuration list for PBXProject "DragAndDropDemo" */; 222 | compatibilityVersion = "Xcode 8.0"; 223 | developmentRegion = en; 224 | hasScannedForEncodings = 0; 225 | knownRegions = ( 226 | en, 227 | Base, 228 | ); 229 | mainGroup = FF43C74C1EF637BE009138CA; 230 | productRefGroup = FF43C7561EF637BE009138CA /* Products */; 231 | projectDirPath = ""; 232 | projectRoot = ""; 233 | targets = ( 234 | FF43C7541EF637BE009138CA /* DragAndDropDemo */, 235 | FF43C7681EF637BF009138CA /* DragAndDropDemoTests */, 236 | FF43C7731EF637BF009138CA /* DragAndDropDemoUITests */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | FF43C7531EF637BE009138CA /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | FF43C7631EF637BF009138CA /* LaunchScreen.storyboard in Resources */, 247 | FF43C7601EF637BF009138CA /* Assets.xcassets in Resources */, 248 | FF43C75E1EF637BF009138CA /* Main.storyboard in Resources */, 249 | ); 250 | runOnlyForDeploymentPostprocessing = 0; 251 | }; 252 | FF43C7671EF637BF009138CA /* Resources */ = { 253 | isa = PBXResourcesBuildPhase; 254 | buildActionMask = 2147483647; 255 | files = ( 256 | ); 257 | runOnlyForDeploymentPostprocessing = 0; 258 | }; 259 | FF43C7721EF637BF009138CA /* Resources */ = { 260 | isa = PBXResourcesBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | /* End PBXResourcesBuildPhase section */ 267 | 268 | /* Begin PBXSourcesBuildPhase section */ 269 | FF43C7511EF637BE009138CA /* Sources */ = { 270 | isa = PBXSourcesBuildPhase; 271 | buildActionMask = 2147483647; 272 | files = ( 273 | FF43C75B1EF637BF009138CA /* ViewController.swift in Sources */, 274 | FF43C7881EF64456009138CA /* ViewController+Drag.swift in Sources */, 275 | FF43C7591EF637BF009138CA /* AppDelegate.swift in Sources */, 276 | FF97071B1EF6482A0024365D /* ViewController+Drop.swift in Sources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | FF43C7651EF637BF009138CA /* Sources */ = { 281 | isa = PBXSourcesBuildPhase; 282 | buildActionMask = 2147483647; 283 | files = ( 284 | FF43C76E1EF637BF009138CA /* DragAndDropDemoTests.swift in Sources */, 285 | ); 286 | runOnlyForDeploymentPostprocessing = 0; 287 | }; 288 | FF43C7701EF637BF009138CA /* Sources */ = { 289 | isa = PBXSourcesBuildPhase; 290 | buildActionMask = 2147483647; 291 | files = ( 292 | FF43C7791EF637BF009138CA /* DragAndDropDemoUITests.swift in Sources */, 293 | ); 294 | runOnlyForDeploymentPostprocessing = 0; 295 | }; 296 | /* End PBXSourcesBuildPhase section */ 297 | 298 | /* Begin PBXTargetDependency section */ 299 | FF43C76B1EF637BF009138CA /* PBXTargetDependency */ = { 300 | isa = PBXTargetDependency; 301 | target = FF43C7541EF637BE009138CA /* DragAndDropDemo */; 302 | targetProxy = FF43C76A1EF637BF009138CA /* PBXContainerItemProxy */; 303 | }; 304 | FF43C7761EF637BF009138CA /* PBXTargetDependency */ = { 305 | isa = PBXTargetDependency; 306 | target = FF43C7541EF637BE009138CA /* DragAndDropDemo */; 307 | targetProxy = FF43C7751EF637BF009138CA /* PBXContainerItemProxy */; 308 | }; 309 | /* End PBXTargetDependency section */ 310 | 311 | /* Begin PBXVariantGroup section */ 312 | FF43C75C1EF637BF009138CA /* Main.storyboard */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | FF43C75D1EF637BF009138CA /* Base */, 316 | ); 317 | name = Main.storyboard; 318 | sourceTree = ""; 319 | }; 320 | FF43C7611EF637BF009138CA /* LaunchScreen.storyboard */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | FF43C7621EF637BF009138CA /* Base */, 324 | ); 325 | name = LaunchScreen.storyboard; 326 | sourceTree = ""; 327 | }; 328 | /* End PBXVariantGroup section */ 329 | 330 | /* Begin XCBuildConfiguration section */ 331 | FF43C77B1EF637BF009138CA /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ALWAYS_SEARCH_USER_PATHS = NO; 335 | CLANG_ANALYZER_NONNULL = YES; 336 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 338 | CLANG_CXX_LIBRARY = "libc++"; 339 | CLANG_ENABLE_MODULES = YES; 340 | CLANG_ENABLE_OBJC_ARC = YES; 341 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 342 | CLANG_WARN_BOOL_CONVERSION = YES; 343 | CLANG_WARN_COMMA = YES; 344 | CLANG_WARN_CONSTANT_CONVERSION = YES; 345 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 346 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 352 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 353 | CLANG_WARN_STRICT_PROTOTYPES = YES; 354 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 355 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 356 | CLANG_WARN_UNREACHABLE_CODE = YES; 357 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 358 | CODE_SIGN_IDENTITY = "iPhone Developer"; 359 | COPY_PHASE_STRIP = NO; 360 | DEBUG_INFORMATION_FORMAT = dwarf; 361 | ENABLE_STRICT_OBJC_MSGSEND = YES; 362 | ENABLE_TESTABILITY = YES; 363 | GCC_C_LANGUAGE_STANDARD = gnu11; 364 | GCC_DYNAMIC_NO_PIC = NO; 365 | GCC_NO_COMMON_BLOCKS = YES; 366 | GCC_OPTIMIZATION_LEVEL = 0; 367 | GCC_PREPROCESSOR_DEFINITIONS = ( 368 | "DEBUG=1", 369 | "$(inherited)", 370 | ); 371 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 372 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 373 | GCC_WARN_UNDECLARED_SELECTOR = YES; 374 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 375 | GCC_WARN_UNUSED_FUNCTION = YES; 376 | GCC_WARN_UNUSED_VARIABLE = YES; 377 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 378 | MTL_ENABLE_DEBUG_INFO = YES; 379 | ONLY_ACTIVE_ARCH = YES; 380 | SDKROOT = iphoneos; 381 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 382 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 383 | }; 384 | name = Debug; 385 | }; 386 | FF43C77C1EF637BF009138CA /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | ALWAYS_SEARCH_USER_PATHS = NO; 390 | CLANG_ANALYZER_NONNULL = YES; 391 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_COMMA = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 402 | CLANG_WARN_EMPTY_BODY = YES; 403 | CLANG_WARN_ENUM_CONVERSION = YES; 404 | CLANG_WARN_INFINITE_RECURSION = YES; 405 | CLANG_WARN_INT_CONVERSION = YES; 406 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 407 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 408 | CLANG_WARN_STRICT_PROTOTYPES = YES; 409 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 410 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | CODE_SIGN_IDENTITY = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 416 | ENABLE_NS_ASSERTIONS = NO; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu11; 419 | GCC_NO_COMMON_BLOCKS = YES; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 427 | MTL_ENABLE_DEBUG_INFO = NO; 428 | SDKROOT = iphoneos; 429 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 430 | VALIDATE_PRODUCT = YES; 431 | }; 432 | name = Release; 433 | }; 434 | FF43C77E1EF637BF009138CA /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | buildSettings = { 437 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 438 | DEVELOPMENT_TEAM = QUZRZDZE98; 439 | INFOPLIST_FILE = DragAndDropDemo/Info.plist; 440 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 441 | PRODUCT_BUNDLE_IDENTIFIER = jp.cokaholic.DragAndDropDemo; 442 | PRODUCT_NAME = "$(TARGET_NAME)"; 443 | SWIFT_VERSION = 4.0; 444 | TARGETED_DEVICE_FAMILY = 2; 445 | }; 446 | name = Debug; 447 | }; 448 | FF43C77F1EF637BF009138CA /* Release */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 452 | DEVELOPMENT_TEAM = QUZRZDZE98; 453 | INFOPLIST_FILE = DragAndDropDemo/Info.plist; 454 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 455 | PRODUCT_BUNDLE_IDENTIFIER = jp.cokaholic.DragAndDropDemo; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | SWIFT_VERSION = 4.0; 458 | TARGETED_DEVICE_FAMILY = 2; 459 | }; 460 | name = Release; 461 | }; 462 | FF43C7811EF637BF009138CA /* Debug */ = { 463 | isa = XCBuildConfiguration; 464 | buildSettings = { 465 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 466 | BUNDLE_LOADER = "$(TEST_HOST)"; 467 | DEVELOPMENT_TEAM = QUZRZDZE98; 468 | INFOPLIST_FILE = DragAndDropDemoTests/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 470 | PRODUCT_BUNDLE_IDENTIFIER = jp.cokaholic.DragAndDropDemoTests; 471 | PRODUCT_NAME = "$(TARGET_NAME)"; 472 | SWIFT_VERSION = 4.0; 473 | TARGETED_DEVICE_FAMILY = "1,2"; 474 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DragAndDropDemo.app/DragAndDropDemo"; 475 | }; 476 | name = Debug; 477 | }; 478 | FF43C7821EF637BF009138CA /* Release */ = { 479 | isa = XCBuildConfiguration; 480 | buildSettings = { 481 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 482 | BUNDLE_LOADER = "$(TEST_HOST)"; 483 | DEVELOPMENT_TEAM = QUZRZDZE98; 484 | INFOPLIST_FILE = DragAndDropDemoTests/Info.plist; 485 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 486 | PRODUCT_BUNDLE_IDENTIFIER = jp.cokaholic.DragAndDropDemoTests; 487 | PRODUCT_NAME = "$(TARGET_NAME)"; 488 | SWIFT_VERSION = 4.0; 489 | TARGETED_DEVICE_FAMILY = "1,2"; 490 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DragAndDropDemo.app/DragAndDropDemo"; 491 | }; 492 | name = Release; 493 | }; 494 | FF43C7841EF637BF009138CA /* Debug */ = { 495 | isa = XCBuildConfiguration; 496 | buildSettings = { 497 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 498 | DEVELOPMENT_TEAM = QUZRZDZE98; 499 | INFOPLIST_FILE = DragAndDropDemoUITests/Info.plist; 500 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 501 | PRODUCT_BUNDLE_IDENTIFIER = jp.cokaholic.DragAndDropDemoUITests; 502 | PRODUCT_NAME = "$(TARGET_NAME)"; 503 | SWIFT_VERSION = 4.0; 504 | TARGETED_DEVICE_FAMILY = "1,2"; 505 | TEST_TARGET_NAME = DragAndDropDemo; 506 | }; 507 | name = Debug; 508 | }; 509 | FF43C7851EF637BF009138CA /* Release */ = { 510 | isa = XCBuildConfiguration; 511 | buildSettings = { 512 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 513 | DEVELOPMENT_TEAM = QUZRZDZE98; 514 | INFOPLIST_FILE = DragAndDropDemoUITests/Info.plist; 515 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 516 | PRODUCT_BUNDLE_IDENTIFIER = jp.cokaholic.DragAndDropDemoUITests; 517 | PRODUCT_NAME = "$(TARGET_NAME)"; 518 | SWIFT_VERSION = 4.0; 519 | TARGETED_DEVICE_FAMILY = "1,2"; 520 | TEST_TARGET_NAME = DragAndDropDemo; 521 | }; 522 | name = Release; 523 | }; 524 | /* End XCBuildConfiguration section */ 525 | 526 | /* Begin XCConfigurationList section */ 527 | FF43C7501EF637BE009138CA /* Build configuration list for PBXProject "DragAndDropDemo" */ = { 528 | isa = XCConfigurationList; 529 | buildConfigurations = ( 530 | FF43C77B1EF637BF009138CA /* Debug */, 531 | FF43C77C1EF637BF009138CA /* Release */, 532 | ); 533 | defaultConfigurationIsVisible = 0; 534 | defaultConfigurationName = Release; 535 | }; 536 | FF43C77D1EF637BF009138CA /* Build configuration list for PBXNativeTarget "DragAndDropDemo" */ = { 537 | isa = XCConfigurationList; 538 | buildConfigurations = ( 539 | FF43C77E1EF637BF009138CA /* Debug */, 540 | FF43C77F1EF637BF009138CA /* Release */, 541 | ); 542 | defaultConfigurationIsVisible = 0; 543 | defaultConfigurationName = Release; 544 | }; 545 | FF43C7801EF637BF009138CA /* Build configuration list for PBXNativeTarget "DragAndDropDemoTests" */ = { 546 | isa = XCConfigurationList; 547 | buildConfigurations = ( 548 | FF43C7811EF637BF009138CA /* Debug */, 549 | FF43C7821EF637BF009138CA /* Release */, 550 | ); 551 | defaultConfigurationIsVisible = 0; 552 | defaultConfigurationName = Release; 553 | }; 554 | FF43C7831EF637BF009138CA /* Build configuration list for PBXNativeTarget "DragAndDropDemoUITests" */ = { 555 | isa = XCConfigurationList; 556 | buildConfigurations = ( 557 | FF43C7841EF637BF009138CA /* Debug */, 558 | FF43C7851EF637BF009138CA /* Release */, 559 | ); 560 | defaultConfigurationIsVisible = 0; 561 | defaultConfigurationName = Release; 562 | }; 563 | /* End XCConfigurationList section */ 564 | }; 565 | rootObject = FF43C74D1EF637BE009138CA /* Project object */; 566 | } 567 | -------------------------------------------------------------------------------- /DragAndDropDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DragAndDropDemo.xcodeproj/xcuserdata/a13931.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DragAndDropDemo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DragAndDropDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DragAndDropDemo 4 | // 5 | // Created by 辰己 佳祐 on 2017/06/18. 6 | // Copyright © 2017年 辰己 佳祐. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/afro_hair.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "ipad", 5 | "filename" : "afro_hair.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "ipad", 10 | "filename" : "afro_hair@2x.png", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/afro_hair.imageset/afro_hair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cokaholic/DragAndDropDemo/7c0aedafc1f9bfc1892167ed0589ea43fcaf530b/DragAndDropDemo/Assets.xcassets/afro_hair.imageset/afro_hair.png -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/afro_hair.imageset/afro_hair@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cokaholic/DragAndDropDemo/7c0aedafc1f9bfc1892167ed0589ea43fcaf530b/DragAndDropDemo/Assets.xcassets/afro_hair.imageset/afro_hair@2x.png -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/base_profile.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "ipad", 5 | "filename" : "base_profile.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "ipad", 10 | "filename" : "base_profile@2x.png", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/base_profile.imageset/base_profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cokaholic/DragAndDropDemo/7c0aedafc1f9bfc1892167ed0589ea43fcaf530b/DragAndDropDemo/Assets.xcassets/base_profile.imageset/base_profile.png -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/base_profile.imageset/base_profile@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cokaholic/DragAndDropDemo/7c0aedafc1f9bfc1892167ed0589ea43fcaf530b/DragAndDropDemo/Assets.xcassets/base_profile.imageset/base_profile@2x.png -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/mask.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "ipad", 5 | "filename" : "mask.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "ipad", 10 | "filename" : "mask@2x.png", 11 | "scale" : "2x" 12 | } 13 | ], 14 | "info" : { 15 | "version" : 1, 16 | "author" : "xcode" 17 | } 18 | } -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/mask.imageset/mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cokaholic/DragAndDropDemo/7c0aedafc1f9bfc1892167ed0589ea43fcaf530b/DragAndDropDemo/Assets.xcassets/mask.imageset/mask.png -------------------------------------------------------------------------------- /DragAndDropDemo/Assets.xcassets/mask.imageset/mask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cokaholic/DragAndDropDemo/7c0aedafc1f9bfc1892167ed0589ea43fcaf530b/DragAndDropDemo/Assets.xcassets/mask.imageset/mask@2x.png -------------------------------------------------------------------------------- /DragAndDropDemo/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 | 27 | 28 | -------------------------------------------------------------------------------- /DragAndDropDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Helvetica-Bold 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 | 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 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /DragAndDropDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | DADDemo 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 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 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /DragAndDropDemo/ViewController+Drag.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController+Drag.swift 3 | // DragAndDropDemo 4 | // 5 | // Created by 辰己 佳祐 on 2017/06/18. 6 | // Copyright © 2017年 辰己 佳祐. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension ViewController: UIDragInteractionDelegate { 12 | 13 | // MARK: - UIDragInteractionDelegate 14 | 15 | func dragInteraction(_ interaction: UIDragInteraction, itemsForBeginning session: UIDragSession) -> [UIDragItem] { 16 | 17 | guard let interactionView = interaction.view else { return [] } 18 | let item: UIDragItem 19 | 20 | if interactionView.isEqual(afroHairImageView) { 21 | guard let image = afroHairImageView.image else { return [] } 22 | item = makeDragItem(image: image) 23 | draggingImageType = .afro 24 | draggingOperationType = .add 25 | } 26 | else if interactionView.isEqual(maskImageView) { 27 | guard let image = maskImageView.image else { return [] } 28 | item = makeDragItem(image: image) 29 | draggingImageType = .mask 30 | draggingOperationType = .add 31 | } 32 | else if interactionView.isEqual(afroContainerImageView) { 33 | guard let image = afroContainerImageView.image else { return [] } 34 | item = makeDragItem(image: image) 35 | draggingImageType = .afro 36 | draggingOperationType = .remove 37 | } 38 | else if interactionView.isEqual(maskContainerImageView) { 39 | guard let image = maskContainerImageView.image else { return [] } 40 | item = makeDragItem(image: image) 41 | draggingImageType = .mask 42 | draggingOperationType = .remove 43 | } 44 | else if interactionView.isEqual(extraContainerImageView) { 45 | guard let image = extraContainerImageView.image else { return [] } 46 | item = makeDragItem(image: image) 47 | draggingImageType = .none 48 | draggingOperationType = .remove 49 | } 50 | else { 51 | return [] 52 | } 53 | return [item] 54 | } 55 | 56 | // MARK: - Helper 57 | 58 | private func makeDragItem(image: UIImage) -> UIDragItem { 59 | let provider = NSItemProvider(object: image) 60 | return UIDragItem(itemProvider: provider) 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /DragAndDropDemo/ViewController+Drop.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController+Drop.swift 3 | // DragAndDropDemo 4 | // 5 | // Created by 辰己 佳祐 on 2017/06/18. 6 | // Copyright © 2017年 辰己 佳祐. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import MobileCoreServices 11 | 12 | extension ViewController: UIDropInteractionDelegate { 13 | 14 | // MARK: - UIDropInteractionDelegate 15 | 16 | func dropInteraction(_ interaction: UIDropInteraction, canHandle session: UIDropSession) -> Bool { 17 | return session.hasItemsConforming(toTypeIdentifiers: [kUTTypeImage as String]) && session.items.count == 1 18 | } 19 | 20 | func dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal { 21 | let dropLocation = session.location(in: view) 22 | let operation: UIDropOperation 23 | switch draggingOperationType { 24 | case .add: 25 | if baseProfileImageView.frame.contains(dropLocation) { 26 | operation = .copy 27 | } else { 28 | operation = .cancel 29 | } 30 | case .remove: 31 | if removeAreaLabel.frame.contains(dropLocation) { 32 | operation = .move 33 | } else { 34 | operation = .cancel 35 | } 36 | } 37 | return UIDropProposal(operation: operation) 38 | } 39 | 40 | func dropInteraction(_ interaction: UIDropInteraction, performDrop session: UIDropSession) { 41 | 42 | session.loadObjects(ofClass: UIImage.self) { [weak self] imageItems in 43 | guard let me = self else { return } 44 | guard let images = imageItems as? [UIImage] else { return } 45 | let image = me.draggingOperationType == .add ? images.first : nil 46 | 47 | switch me.draggingImageType { 48 | case .afro: 49 | me.afroContainerImageView.image = image 50 | case .mask: 51 | me.maskContainerImageView.image = image 52 | case .none: 53 | me.extraContainerImageView.image = image 54 | } 55 | 56 | me.draggingImageType = .none 57 | me.draggingOperationType = .add 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /DragAndDropDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // DragAndDropDemo 4 | // 5 | // Created by 辰己 佳祐 on 2017/06/18. 6 | // Copyright © 2017年 辰己 佳祐. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | enum DraggingImageType { 14 | case none 15 | case afro 16 | case mask 17 | } 18 | 19 | enum DraggingOperationType { 20 | case add 21 | case remove 22 | } 23 | 24 | @IBOutlet weak var baseProfileImageView: UIImageView! 25 | @IBOutlet weak var afroContainerImageView: UIImageView! 26 | @IBOutlet weak var maskContainerImageView: UIImageView! 27 | @IBOutlet weak var extraContainerImageView: UIImageView! 28 | @IBOutlet weak var afroHairImageView: UIImageView! 29 | @IBOutlet weak var maskImageView: UIImageView! 30 | @IBOutlet weak var removeAreaLabel: UILabel! { 31 | didSet { 32 | removeAreaLabel.layer.borderColor = UIColor.red.cgColor 33 | removeAreaLabel.layer.borderWidth = 2.0 34 | } 35 | } 36 | var draggingImageType: DraggingImageType = .none 37 | var draggingOperationType: DraggingOperationType = .add 38 | 39 | override func viewDidLoad() { 40 | super.viewDidLoad() 41 | 42 | // Angle of the afro. 43 | afroContainerImageView.transform = CGAffineTransform(rotationAngle: -.pi / 30.0) 44 | 45 | // Angle of the mask. 46 | maskContainerImageView.transform = CGAffineTransform(rotationAngle: -.pi / 10.0) 47 | 48 | afroHairImageView.isUserInteractionEnabled = true 49 | afroHairImageView.addInteraction(UIDragInteraction(delegate: self)) 50 | 51 | maskImageView.isUserInteractionEnabled = true 52 | maskImageView.addInteraction(UIDragInteraction(delegate: self)) 53 | 54 | afroContainerImageView.isUserInteractionEnabled = true 55 | afroContainerImageView.addInteraction(UIDragInteraction(delegate: self)) 56 | 57 | maskContainerImageView.isUserInteractionEnabled = true 58 | maskContainerImageView.addInteraction(UIDragInteraction(delegate: self)) 59 | 60 | extraContainerImageView.isUserInteractionEnabled = true 61 | extraContainerImageView.addInteraction(UIDragInteraction(delegate: self)) 62 | 63 | view.addInteraction(UIDropInteraction(delegate: self)) 64 | } 65 | } 66 | 67 | -------------------------------------------------------------------------------- /DragAndDropDemoTests/DragAndDropDemoTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DragAndDropDemoTests.swift 3 | // DragAndDropDemoTests 4 | // 5 | // Created by 辰己 佳祐 on 2017/06/18. 6 | // Copyright © 2017年 辰己 佳祐. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import DragAndDropDemo 11 | 12 | class DragAndDropDemoTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measure { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /DragAndDropDemoTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /DragAndDropDemoUITests/DragAndDropDemoUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // DragAndDropDemoUITests.swift 3 | // DragAndDropDemoUITests 4 | // 5 | // Created by 辰己 佳祐 on 2017/06/18. 6 | // Copyright © 2017年 辰己 佳祐. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class DragAndDropDemoUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /DragAndDropDemoUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | --------------------------------------------------------------------------------