├── .gitignore ├── CollectionViewWithMovingItem.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── frogcjn.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── frogcjn.xcuserdatad │ └── xcschemes │ ├── CollectionViewWithMovingItem.xcscheme │ └── xcschememanagement.plist ├── CollectionViewWithMovingItem ├── .DS_Store ├── AppDelegate.swift ├── Assets.xcassets │ ├── .DS_Store │ ├── 0_full.imageset │ │ ├── 0_full.jpg │ │ └── Contents.json │ ├── 10_full.imageset │ │ ├── 10_full.jpg │ │ └── Contents.json │ ├── 11_full.imageset │ │ ├── 11_full.jpg │ │ └── Contents.json │ ├── 12_full.imageset │ │ ├── 12_full.jpg │ │ └── Contents.json │ ├── 13_full.imageset │ │ ├── 13_full.jpg │ │ └── Contents.json │ ├── 14_full.imageset │ │ ├── 14_full.jpg │ │ └── Contents.json │ ├── 15_full.imageset │ │ ├── 15_full.jpg │ │ └── Contents.json │ ├── 16_full.imageset │ │ ├── 16_full.jpg │ │ └── Contents.json │ ├── 17_full.imageset │ │ ├── 17_full.jpg │ │ └── Contents.json │ ├── 18_full.imageset │ │ ├── 18_full.jpg │ │ └── Contents.json │ ├── 19_full.imageset │ │ ├── 19_full.jpg │ │ └── Contents.json │ ├── 1_full.imageset │ │ ├── 1_full.jpg │ │ └── Contents.json │ ├── 20_full.imageset │ │ ├── 20_full.jpg │ │ └── Contents.json │ ├── 21_full.imageset │ │ ├── 21_full.jpg │ │ └── Contents.json │ ├── 22_full.imageset │ │ ├── 22_full.jpg │ │ └── Contents.json │ ├── 23_full.imageset │ │ ├── 23_full.jpg │ │ └── Contents.json │ ├── 24_full.imageset │ │ ├── 24_full.jpg │ │ └── Contents.json │ ├── 25_full.imageset │ │ ├── 25_full.jpg │ │ └── Contents.json │ ├── 26_full.imageset │ │ ├── 26_full.jpg │ │ └── Contents.json │ ├── 27_full.imageset │ │ ├── 27_full.jpg │ │ └── Contents.json │ ├── 28_full.imageset │ │ ├── 28_full.jpg │ │ └── Contents.json │ ├── 29_full.imageset │ │ ├── 29_full.jpg │ │ └── Contents.json │ ├── 2_full.imageset │ │ ├── 2_full.jpg │ │ └── Contents.json │ ├── 30_full.imageset │ │ ├── 30_full.jpg │ │ └── Contents.json │ ├── 31_full.imageset │ │ ├── 31_full.jpg │ │ └── Contents.json │ ├── 3_full.imageset │ │ ├── 3_full.jpg │ │ └── Contents.json │ ├── 4_full.imageset │ │ ├── 4_full.jpg │ │ └── Contents.json │ ├── 5_full.imageset │ │ ├── 5_full.jpg │ │ └── Contents.json │ ├── 6_full.imageset │ │ ├── 6_full.jpg │ │ └── Contents.json │ ├── 7_full.imageset │ │ ├── 7_full.jpg │ │ └── Contents.json │ ├── 8_full.imageset │ │ ├── 8_full.jpg │ │ └── Contents.json │ ├── 9_full.imageset │ │ ├── 9_full.jpg │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ └── LaunchScreen.storyboard ├── Info.plist ├── Main.storyboard ├── Photo.swift ├── PhotoCell.swift └── PhotosCC.swift ├── README.md └── _mov.gif /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/swift,xcode 3 | # Edit at https://www.gitignore.io/?templates=swift,xcode 4 | 5 | ### Swift ### 6 | # Xcode 7 | # 8 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 9 | 10 | ## Build generated 11 | build/ 12 | DerivedData/ 13 | 14 | ## Various settings 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata/ 24 | 25 | ## Other 26 | *.moved-aside 27 | *.xccheckout 28 | *.xcscmblueprint 29 | 30 | ## Obj-C/Swift specific 31 | *.hmap 32 | *.ipa 33 | *.dSYM.zip 34 | *.dSYM 35 | 36 | ## Playgrounds 37 | timeline.xctimeline 38 | playground.xcworkspace 39 | 40 | # Swift Package Manager 41 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 42 | # Packages/ 43 | # Package.pins 44 | # Package.resolved 45 | .build/ 46 | 47 | # CocoaPods 48 | # We recommend against adding the Pods directory to your .gitignore. However 49 | # you should judge for yourself, the pros and cons are mentioned at: 50 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 51 | # Pods/ 52 | # Add this line if you want to avoid checking in source code from the Xcode workspace 53 | # *.xcworkspace 54 | 55 | # Carthage 56 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 57 | # Carthage/Checkouts 58 | 59 | Carthage/Build 60 | 61 | # fastlane 62 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 63 | # screenshots whenever they are needed. 64 | # For more information about the recommended setup visit: 65 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 66 | 67 | fastlane/report.xml 68 | fastlane/Preview.html 69 | fastlane/screenshots/**/*.png 70 | fastlane/test_output 71 | 72 | # Code Injection 73 | # After new code Injection tools there's a generated folder /iOSInjectionProject 74 | # https://github.com/johnno1962/injectionforxcode 75 | 76 | iOSInjectionProject/ 77 | 78 | ### Xcode ### 79 | # Xcode 80 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 81 | 82 | ## User settings 83 | 84 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 85 | 86 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 87 | 88 | ### Xcode Patch ### 89 | *.xcodeproj/* 90 | !*.xcodeproj/project.pbxproj 91 | !*.xcodeproj/xcshareddata/ 92 | !*.xcworkspace/contents.xcworkspacedata 93 | /*.gcno 94 | **/xcshareddata/WorkspaceSettings.xcsettings 95 | 96 | # End of https://www.gitignore.io/api/swift,xcode -------------------------------------------------------------------------------- /CollectionViewWithMovingItem.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2D0E7184226744F100295BA0 /* Photo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D0E7183226744F100295BA0 /* Photo.swift */; }; 11 | 2D0E71862267476100295BA0 /* PhotoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D0E71852267476100295BA0 /* PhotoCell.swift */; }; 12 | 6DA648AD1B3ADE87005FD2D7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DA648AC1B3ADE87005FD2D7 /* AppDelegate.swift */; }; 13 | 6DA648B41B3ADE87005FD2D7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6DA648B31B3ADE87005FD2D7 /* Assets.xcassets */; }; 14 | 6DA648B71B3ADE87005FD2D7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6DA648B51B3ADE87005FD2D7 /* LaunchScreen.storyboard */; }; 15 | 6DA648BF1B3ADE96005FD2D7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 6DA648BE1B3ADE96005FD2D7 /* Main.storyboard */; }; 16 | 6DA648C11B3ADEF7005FD2D7 /* PhotosCC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6DA648C01B3ADEF7005FD2D7 /* PhotosCC.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 2D0E7183226744F100295BA0 /* Photo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Photo.swift; sourceTree = ""; }; 21 | 2D0E71852267476100295BA0 /* PhotoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoCell.swift; sourceTree = ""; }; 22 | 6DA648A91B3ADE87005FD2D7 /* CollectionViewWithMovingItem.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CollectionViewWithMovingItem.app; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | 6DA648AC1B3ADE87005FD2D7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | 6DA648B31B3ADE87005FD2D7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 25 | 6DA648B61B3ADE87005FD2D7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 26 | 6DA648B81B3ADE87005FD2D7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 27 | 6DA648BE1B3ADE96005FD2D7 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 28 | 6DA648C01B3ADEF7005FD2D7 /* PhotosCC.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotosCC.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 6DA648A61B3ADE87005FD2D7 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 6DA648A01B3ADE87005FD2D7 = { 43 | isa = PBXGroup; 44 | children = ( 45 | 6DA648AB1B3ADE87005FD2D7 /* CollectionViewWithMovingItem */, 46 | 6DA648AA1B3ADE87005FD2D7 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 6DA648AA1B3ADE87005FD2D7 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 6DA648A91B3ADE87005FD2D7 /* CollectionViewWithMovingItem.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 6DA648AB1B3ADE87005FD2D7 /* CollectionViewWithMovingItem */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 6DA648AC1B3ADE87005FD2D7 /* AppDelegate.swift */, 62 | 6DA648C01B3ADEF7005FD2D7 /* PhotosCC.swift */, 63 | 2D0E7183226744F100295BA0 /* Photo.swift */, 64 | 2D0E71852267476100295BA0 /* PhotoCell.swift */, 65 | 6DA648BE1B3ADE96005FD2D7 /* Main.storyboard */, 66 | 6DA648B31B3ADE87005FD2D7 /* Assets.xcassets */, 67 | 6DA648B51B3ADE87005FD2D7 /* LaunchScreen.storyboard */, 68 | 6DA648B81B3ADE87005FD2D7 /* Info.plist */, 69 | ); 70 | path = CollectionViewWithMovingItem; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | 6DA648A81B3ADE87005FD2D7 /* CollectionViewWithMovingItem */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = 6DA648BB1B3ADE87005FD2D7 /* Build configuration list for PBXNativeTarget "CollectionViewWithMovingItem" */; 79 | buildPhases = ( 80 | 6DA648A51B3ADE87005FD2D7 /* Sources */, 81 | 6DA648A61B3ADE87005FD2D7 /* Frameworks */, 82 | 6DA648A71B3ADE87005FD2D7 /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = CollectionViewWithMovingItem; 89 | productName = CollectionViewWithMovingItem; 90 | productReference = 6DA648A91B3ADE87005FD2D7 /* CollectionViewWithMovingItem.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | 6DA648A11B3ADE87005FD2D7 /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | LastUpgradeCheck = 0700; 100 | ORGANIZATIONNAME = "Cao Jiannan"; 101 | TargetAttributes = { 102 | 6DA648A81B3ADE87005FD2D7 = { 103 | CreatedOnToolsVersion = 7.0; 104 | }; 105 | }; 106 | }; 107 | buildConfigurationList = 6DA648A41B3ADE87005FD2D7 /* Build configuration list for PBXProject "CollectionViewWithMovingItem" */; 108 | compatibilityVersion = "Xcode 3.2"; 109 | developmentRegion = English; 110 | hasScannedForEncodings = 0; 111 | knownRegions = ( 112 | English, 113 | en, 114 | Base, 115 | ); 116 | mainGroup = 6DA648A01B3ADE87005FD2D7; 117 | productRefGroup = 6DA648AA1B3ADE87005FD2D7 /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | 6DA648A81B3ADE87005FD2D7 /* CollectionViewWithMovingItem */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | 6DA648A71B3ADE87005FD2D7 /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | 6DA648B71B3ADE87005FD2D7 /* LaunchScreen.storyboard in Resources */, 132 | 6DA648B41B3ADE87005FD2D7 /* Assets.xcassets in Resources */, 133 | 6DA648BF1B3ADE96005FD2D7 /* Main.storyboard in Resources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXResourcesBuildPhase section */ 138 | 139 | /* Begin PBXSourcesBuildPhase section */ 140 | 6DA648A51B3ADE87005FD2D7 /* Sources */ = { 141 | isa = PBXSourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | 2D0E71862267476100295BA0 /* PhotoCell.swift in Sources */, 145 | 2D0E7184226744F100295BA0 /* Photo.swift in Sources */, 146 | 6DA648C11B3ADEF7005FD2D7 /* PhotosCC.swift in Sources */, 147 | 6DA648AD1B3ADE87005FD2D7 /* AppDelegate.swift in Sources */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXSourcesBuildPhase section */ 152 | 153 | /* Begin PBXVariantGroup section */ 154 | 6DA648B51B3ADE87005FD2D7 /* LaunchScreen.storyboard */ = { 155 | isa = PBXVariantGroup; 156 | children = ( 157 | 6DA648B61B3ADE87005FD2D7 /* Base */, 158 | ); 159 | name = LaunchScreen.storyboard; 160 | sourceTree = ""; 161 | }; 162 | /* End PBXVariantGroup section */ 163 | 164 | /* Begin XCBuildConfiguration section */ 165 | 6DA648B91B3ADE87005FD2D7 /* Debug */ = { 166 | isa = XCBuildConfiguration; 167 | buildSettings = { 168 | ALWAYS_SEARCH_USER_PATHS = NO; 169 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 170 | CLANG_CXX_LIBRARY = "libc++"; 171 | CLANG_ENABLE_MODULES = YES; 172 | CLANG_ENABLE_OBJC_ARC = YES; 173 | CLANG_WARN_BOOL_CONVERSION = YES; 174 | CLANG_WARN_CONSTANT_CONVERSION = YES; 175 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 176 | CLANG_WARN_EMPTY_BODY = YES; 177 | CLANG_WARN_ENUM_CONVERSION = YES; 178 | CLANG_WARN_INT_CONVERSION = YES; 179 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 180 | CLANG_WARN_UNREACHABLE_CODE = YES; 181 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 182 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 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 = gnu99; 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 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 202 | MTL_ENABLE_DEBUG_INFO = YES; 203 | ONLY_ACTIVE_ARCH = YES; 204 | SDKROOT = iphoneos; 205 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 206 | }; 207 | name = Debug; 208 | }; 209 | 6DA648BA1B3ADE87005FD2D7 /* Release */ = { 210 | isa = XCBuildConfiguration; 211 | buildSettings = { 212 | ALWAYS_SEARCH_USER_PATHS = NO; 213 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 214 | CLANG_CXX_LIBRARY = "libc++"; 215 | CLANG_ENABLE_MODULES = YES; 216 | CLANG_ENABLE_OBJC_ARC = YES; 217 | CLANG_WARN_BOOL_CONVERSION = YES; 218 | CLANG_WARN_CONSTANT_CONVERSION = YES; 219 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 220 | CLANG_WARN_EMPTY_BODY = YES; 221 | CLANG_WARN_ENUM_CONVERSION = YES; 222 | CLANG_WARN_INT_CONVERSION = YES; 223 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 224 | CLANG_WARN_UNREACHABLE_CODE = YES; 225 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 226 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 227 | COPY_PHASE_STRIP = NO; 228 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 229 | ENABLE_NS_ASSERTIONS = NO; 230 | ENABLE_STRICT_OBJC_MSGSEND = YES; 231 | GCC_C_LANGUAGE_STANDARD = gnu99; 232 | GCC_NO_COMMON_BLOCKS = YES; 233 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 235 | GCC_WARN_UNDECLARED_SELECTOR = YES; 236 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 237 | GCC_WARN_UNUSED_FUNCTION = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 240 | MTL_ENABLE_DEBUG_INFO = NO; 241 | SDKROOT = iphoneos; 242 | VALIDATE_PRODUCT = YES; 243 | }; 244 | name = Release; 245 | }; 246 | 6DA648BC1B3ADE87005FD2D7 /* Debug */ = { 247 | isa = XCBuildConfiguration; 248 | buildSettings = { 249 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 250 | INFOPLIST_FILE = CollectionViewWithMovingItem/Info.plist; 251 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 252 | PRODUCT_BUNDLE_IDENTIFIER = org.frogcjn.CollectionViewWithMovingItem; 253 | PRODUCT_NAME = "$(TARGET_NAME)"; 254 | SWIFT_VERSION = 5.0; 255 | }; 256 | name = Debug; 257 | }; 258 | 6DA648BD1B3ADE87005FD2D7 /* Release */ = { 259 | isa = XCBuildConfiguration; 260 | buildSettings = { 261 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 262 | INFOPLIST_FILE = CollectionViewWithMovingItem/Info.plist; 263 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 264 | PRODUCT_BUNDLE_IDENTIFIER = org.frogcjn.CollectionViewWithMovingItem; 265 | PRODUCT_NAME = "$(TARGET_NAME)"; 266 | SWIFT_VERSION = 5.0; 267 | }; 268 | name = Release; 269 | }; 270 | /* End XCBuildConfiguration section */ 271 | 272 | /* Begin XCConfigurationList section */ 273 | 6DA648A41B3ADE87005FD2D7 /* Build configuration list for PBXProject "CollectionViewWithMovingItem" */ = { 274 | isa = XCConfigurationList; 275 | buildConfigurations = ( 276 | 6DA648B91B3ADE87005FD2D7 /* Debug */, 277 | 6DA648BA1B3ADE87005FD2D7 /* Release */, 278 | ); 279 | defaultConfigurationIsVisible = 0; 280 | defaultConfigurationName = Release; 281 | }; 282 | 6DA648BB1B3ADE87005FD2D7 /* Build configuration list for PBXNativeTarget "CollectionViewWithMovingItem" */ = { 283 | isa = XCConfigurationList; 284 | buildConfigurations = ( 285 | 6DA648BC1B3ADE87005FD2D7 /* Debug */, 286 | 6DA648BD1B3ADE87005FD2D7 /* Release */, 287 | ); 288 | defaultConfigurationIsVisible = 0; 289 | defaultConfigurationName = Release; 290 | }; 291 | /* End XCConfigurationList section */ 292 | }; 293 | rootObject = 6DA648A11B3ADE87005FD2D7 /* Project object */; 294 | } 295 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem.xcodeproj/project.xcworkspace/xcuserdata/frogcjn.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem.xcodeproj/project.xcworkspace/xcuserdata/frogcjn.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CollectionViewWithMovingItem.xcodeproj/xcuserdata/frogcjn.xcuserdatad/xcschemes/CollectionViewWithMovingItem.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 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem.xcodeproj/xcuserdata/frogcjn.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CollectionViewWithMovingItem.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 6DA648A81B3ADE87005FD2D7 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/.DS_Store -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CollectionViewWithMovingItem 4 | // 5 | // Created by 曹剑楠 on 15/6/24. 6 | // Copyright © 2015年 Cao Jiannan. 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: [UIApplication.LaunchOptionsKey : Any]? = nil) -> 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 throttle down OpenGL ES frame rates. 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 inactive 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 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/.DS_Store -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/0_full.imageset/0_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/0_full.imageset/0_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/0_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "0_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/10_full.imageset/10_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/10_full.imageset/10_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/10_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "10_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/11_full.imageset/11_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/11_full.imageset/11_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/11_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "11_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/12_full.imageset/12_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/12_full.imageset/12_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/12_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "12_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/13_full.imageset/13_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/13_full.imageset/13_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/13_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "13_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/14_full.imageset/14_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/14_full.imageset/14_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/14_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "14_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/15_full.imageset/15_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/15_full.imageset/15_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/15_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "15_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/16_full.imageset/16_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/16_full.imageset/16_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/16_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "16_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/17_full.imageset/17_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/17_full.imageset/17_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/17_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "17_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/18_full.imageset/18_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/18_full.imageset/18_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/18_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "18_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/19_full.imageset/19_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/19_full.imageset/19_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/19_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "19_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/1_full.imageset/1_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/1_full.imageset/1_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/1_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "1_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/20_full.imageset/20_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/20_full.imageset/20_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/20_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "20_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/21_full.imageset/21_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/21_full.imageset/21_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/21_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "21_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/22_full.imageset/22_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/22_full.imageset/22_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/22_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "22_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/23_full.imageset/23_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/23_full.imageset/23_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/23_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "23_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/24_full.imageset/24_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/24_full.imageset/24_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/24_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "24_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/25_full.imageset/25_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/25_full.imageset/25_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/25_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "25_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/26_full.imageset/26_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/26_full.imageset/26_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/26_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "26_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/27_full.imageset/27_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/27_full.imageset/27_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/27_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "27_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/28_full.imageset/28_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/28_full.imageset/28_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/28_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "28_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/29_full.imageset/29_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/29_full.imageset/29_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/29_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "29_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/2_full.imageset/2_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/2_full.imageset/2_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/2_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "2_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/30_full.imageset/30_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/30_full.imageset/30_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/30_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "30_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/31_full.imageset/31_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/31_full.imageset/31_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/31_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "31_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/3_full.imageset/3_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/3_full.imageset/3_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/3_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "3_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/4_full.imageset/4_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/4_full.imageset/4_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/4_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "4_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/5_full.imageset/5_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/5_full.imageset/5_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/5_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "5_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/6_full.imageset/6_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/6_full.imageset/6_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/6_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "6_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/7_full.imageset/7_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/7_full.imageset/7_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/7_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "7_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/8_full.imageset/8_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/8_full.imageset/8_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/8_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "8_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/9_full.imageset/9_full.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/CollectionViewWithMovingItem/Assets.xcassets/9_full.imageset/9_full.jpg -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/9_full.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "9_full.jpg", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 26 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/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 | 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 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/Photo.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Photo.swift 3 | // CollectionViewWithMovingItem 4 | // 5 | // Created by Asaf Baibekov on 17/04/2019. 6 | // Copyright © 2019 Cao Jiannan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class Photo { 12 | var imageName: String 13 | 14 | init(imageName: String) { 15 | self.imageName = imageName 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/PhotoCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // PhotoCell.swift 3 | // CollectionViewWithMovingItem 4 | // 5 | // Created by Asaf Baibekov on 17/04/2019. 6 | // Copyright © 2019 Cao Jiannan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class PhotoCell: UICollectionViewCell { 12 | @IBOutlet weak var imageView: UIImageView! 13 | } 14 | -------------------------------------------------------------------------------- /CollectionViewWithMovingItem/PhotosCC.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ThingsCC.swift 3 | // Tota 4 | // 5 | // Created by 曹剑楠 on 15/5/27. 6 | // Cootyright (c) 2015年 Cao Jiannan. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | private let reuseIdentifier = "PhotoCell" 12 | 13 | class PhotosCC: UICollectionViewController { 14 | 15 | lazy var dataItems: [Photo] = { 16 | var photos = [Photo]() 17 | for index in 0...15 { 18 | photos.append(Photo(imageName: "\(index)_full")) 19 | } 20 | return photos 21 | }() 22 | 23 | override func viewDidLoad() { 24 | super.viewDidLoad() 25 | 26 | //this sentence is not neccesary, becuase its default value is true 27 | //self.installsStandardGestureForInteractiveMovement = true 28 | } 29 | 30 | @IBAction func tapButton(sender: UIBarButtonItem) { 31 | print(self.installsStandardGestureForInteractiveMovement) 32 | if let cell = collectionView.cellForItem(at: IndexPath(item: 0, section: 0)) { 33 | print(cell.contentView.gestureRecognizers!) 34 | } 35 | } 36 | } 37 | 38 | extension PhotosCC { 39 | 40 | // MARK: UICollectionViewDataSource 41 | 42 | override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 43 | return dataItems.count 44 | } 45 | 46 | override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 47 | if let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as? PhotoCell { 48 | let item = dataItems[indexPath.row] 49 | //cell.textLabel?.text = thing.name 50 | cell.imageView.image = UIImage(named: item.imageName) 51 | return cell 52 | } 53 | return UICollectionViewCell() 54 | } 55 | 56 | //this override is not neccesary, becuase its default return is true 57 | /*override func collectionView(_ collectionView: UICollectionView, canMoveItemAt indexPath: IndexPath) -> Bool { 58 | return true 59 | }*/ 60 | 61 | //must override to get movingItem feature worked 62 | override func collectionView(_ collectionView: UICollectionView, moveItemAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) { 63 | dataItems.insert(dataItems.remove(at: sourceIndexPath.row), at: destinationIndexPath.row) 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CollectionViewWithMovingItem 2 | ==================== 3 | 4 | This sample code shows how to use official API to move/drag item in collection, which is new feature in iOS9. 5 | 6 | Instruction on Dragging: 7 | 8 | * long press item to start moving 9 | * release touch to put item down 10 | 11 | 12 | Instruction on Development: 13 | 14 | In order to let the movingItem feature work, you should do 2 things: 15 | 16 | * Using UICollectionViewController 17 | 18 | It will automatically install UILongPressGestureRecognizer to your cell.contentView. 19 | In default, UICollectionViewController.installsStandardGestureForInteractiveMovement = true 20 | 21 | * Implement/Override collectionView(_:moveItemAtIndexPath:toIndexPath) 22 | 23 | This function is required to implement, in order to get dragItem feature 24 | 25 | 26 | ![ScreenShot](_mov.gif) 27 | -------------------------------------------------------------------------------- /_mov.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frogcjn/UICollectionView-Move-Drag-Item-iOS9/912eb4ae6a0de22d37c618a0dc26be7451805c85/_mov.gif --------------------------------------------------------------------------------