├── README.md ├── SwiftUIDragDropDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── miznahalobaishy.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist └── SwiftUIDragDropDemo ├── Assets.xcassets ├── AccentColor.colorset │ └── Contents.json ├── AppIcon.appiconset │ └── Contents.json ├── Blazed Croissant.imageset │ ├── Contents.json │ └── Screen Shot 2022-06-09 at 2.24.21 PM.png ├── Blazed Donouts.imageset │ ├── Contents.json │ └── Image.png ├── Boston Donouts.imageset │ ├── Contents.json │ └── Image.png ├── Chocolate Croissant.imageset │ ├── Contents.json │ └── Screen Shot 2022-06-09 at 2.24.59 PM.png ├── Cholocate Donouts.imageset │ ├── Contents.json │ └── Image.png ├── Contents.json ├── Creamy Donouts.imageset │ ├── Contents.json │ └── Image.png ├── Croissant with Nuts.imageset │ ├── Contents.json │ └── Screen Shot 2022-06-09 at 2.26.12 PM.png ├── Donouts with sparkles.imageset │ ├── Contents.json │ └── Image.png ├── Latte Espresso.imageset │ ├── Contents.json │ └── Image.png ├── Machhiato Espresso.imageset │ ├── Contents.json │ └── Image.png ├── Mega Croissant.imageset │ ├── Contents.json │ └── Image.png ├── Mocha Espresso.imageset │ ├── Contents.json │ └── Image.png ├── Piccolo Latte Espresso.imageset │ ├── Contents.json │ └── Image.png ├── Red Eye Espresso.imageset │ ├── Contents.json │ └── Image.png ├── Ristretto Espresso.imageset │ ├── Contents.json │ └── Image.png ├── Somatra Espresso.imageset │ ├── Contents.json │ └── Image.png ├── Steamed Espresso.imageset │ ├── Contents.json │ └── Image.png ├── Sugar Croissant.imageset │ ├── Contents.json │ └── Image.png └── coffeeBg.imageset │ ├── Contents.json │ └── Screen Shot 2022-06-09 at 5.42.45 PM.png ├── ContentView.swift ├── Model.swift ├── Preview Content └── Preview Assets.xcassets │ └── Contents.json └── SwiftUIDragDropDemoApp.swift /README.md: -------------------------------------------------------------------------------- 1 | # SwiftUIDragDropDemo 2 | 3 | ## This SwiftUI project demos how easily to create Drag-Drop without any 3rd libs 4 | 5 | ![ezgif com-gif-maker (1)](https://user-images.githubusercontent.com/34104180/187982956-b614a44f-7cea-4d16-af6e-ee08c71e8bbf.gif) 6 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 55; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | BA69D94028C128730087D2FE /* SwiftUIDragDropDemoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA69D93F28C128730087D2FE /* SwiftUIDragDropDemoApp.swift */; }; 11 | BA69D94228C128730087D2FE /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA69D94128C128730087D2FE /* ContentView.swift */; }; 12 | BA69D94428C128740087D2FE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BA69D94328C128740087D2FE /* Assets.xcassets */; }; 13 | BA69D94728C128740087D2FE /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BA69D94628C128740087D2FE /* Preview Assets.xcassets */; }; 14 | BA69D94E28C128880087D2FE /* Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA69D94D28C128880087D2FE /* Model.swift */; }; 15 | /* End PBXBuildFile section */ 16 | 17 | /* Begin PBXFileReference section */ 18 | BA69D93C28C128730087D2FE /* SwiftUIDragDropDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftUIDragDropDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 19 | BA69D93F28C128730087D2FE /* SwiftUIDragDropDemoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIDragDropDemoApp.swift; sourceTree = ""; }; 20 | BA69D94128C128730087D2FE /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 21 | BA69D94328C128740087D2FE /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 22 | BA69D94628C128740087D2FE /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; 23 | BA69D94D28C128880087D2FE /* Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Model.swift; sourceTree = ""; }; 24 | /* End PBXFileReference section */ 25 | 26 | /* Begin PBXFrameworksBuildPhase section */ 27 | BA69D93928C128730087D2FE /* Frameworks */ = { 28 | isa = PBXFrameworksBuildPhase; 29 | buildActionMask = 2147483647; 30 | files = ( 31 | ); 32 | runOnlyForDeploymentPostprocessing = 0; 33 | }; 34 | /* End PBXFrameworksBuildPhase section */ 35 | 36 | /* Begin PBXGroup section */ 37 | BA69D93328C128730087D2FE = { 38 | isa = PBXGroup; 39 | children = ( 40 | BA69D93E28C128730087D2FE /* SwiftUIDragDropDemo */, 41 | BA69D93D28C128730087D2FE /* Products */, 42 | ); 43 | sourceTree = ""; 44 | }; 45 | BA69D93D28C128730087D2FE /* Products */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | BA69D93C28C128730087D2FE /* SwiftUIDragDropDemo.app */, 49 | ); 50 | name = Products; 51 | sourceTree = ""; 52 | }; 53 | BA69D93E28C128730087D2FE /* SwiftUIDragDropDemo */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | BA69D93F28C128730087D2FE /* SwiftUIDragDropDemoApp.swift */, 57 | BA69D94128C128730087D2FE /* ContentView.swift */, 58 | BA69D94D28C128880087D2FE /* Model.swift */, 59 | BA69D94328C128740087D2FE /* Assets.xcassets */, 60 | BA69D94528C128740087D2FE /* Preview Content */, 61 | ); 62 | path = SwiftUIDragDropDemo; 63 | sourceTree = ""; 64 | }; 65 | BA69D94528C128740087D2FE /* Preview Content */ = { 66 | isa = PBXGroup; 67 | children = ( 68 | BA69D94628C128740087D2FE /* Preview Assets.xcassets */, 69 | ); 70 | path = "Preview Content"; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | BA69D93B28C128730087D2FE /* SwiftUIDragDropDemo */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = BA69D94A28C128740087D2FE /* Build configuration list for PBXNativeTarget "SwiftUIDragDropDemo" */; 79 | buildPhases = ( 80 | BA69D93828C128730087D2FE /* Sources */, 81 | BA69D93928C128730087D2FE /* Frameworks */, 82 | BA69D93A28C128730087D2FE /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = SwiftUIDragDropDemo; 89 | productName = SwiftUIDragDropDemo; 90 | productReference = BA69D93C28C128730087D2FE /* SwiftUIDragDropDemo.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | BA69D93428C128730087D2FE /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | BuildIndependentTargetsInParallel = 1; 100 | LastSwiftUpdateCheck = 1340; 101 | LastUpgradeCheck = 1340; 102 | TargetAttributes = { 103 | BA69D93B28C128730087D2FE = { 104 | CreatedOnToolsVersion = 13.4.1; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = BA69D93728C128730087D2FE /* Build configuration list for PBXProject "SwiftUIDragDropDemo" */; 109 | compatibilityVersion = "Xcode 13.0"; 110 | developmentRegion = en; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = BA69D93328C128730087D2FE; 117 | productRefGroup = BA69D93D28C128730087D2FE /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | BA69D93B28C128730087D2FE /* SwiftUIDragDropDemo */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | BA69D93A28C128730087D2FE /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | BA69D94728C128740087D2FE /* Preview Assets.xcassets in Resources */, 132 | BA69D94428C128740087D2FE /* Assets.xcassets in Resources */, 133 | ); 134 | runOnlyForDeploymentPostprocessing = 0; 135 | }; 136 | /* End PBXResourcesBuildPhase section */ 137 | 138 | /* Begin PBXSourcesBuildPhase section */ 139 | BA69D93828C128730087D2FE /* Sources */ = { 140 | isa = PBXSourcesBuildPhase; 141 | buildActionMask = 2147483647; 142 | files = ( 143 | BA69D94E28C128880087D2FE /* Model.swift in Sources */, 144 | BA69D94228C128730087D2FE /* ContentView.swift in Sources */, 145 | BA69D94028C128730087D2FE /* SwiftUIDragDropDemoApp.swift in Sources */, 146 | ); 147 | runOnlyForDeploymentPostprocessing = 0; 148 | }; 149 | /* End PBXSourcesBuildPhase section */ 150 | 151 | /* Begin XCBuildConfiguration section */ 152 | BA69D94828C128740087D2FE /* Debug */ = { 153 | isa = XCBuildConfiguration; 154 | buildSettings = { 155 | ALWAYS_SEARCH_USER_PATHS = NO; 156 | CLANG_ANALYZER_NONNULL = YES; 157 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 158 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 159 | CLANG_ENABLE_MODULES = YES; 160 | CLANG_ENABLE_OBJC_ARC = YES; 161 | CLANG_ENABLE_OBJC_WEAK = YES; 162 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 163 | CLANG_WARN_BOOL_CONVERSION = YES; 164 | CLANG_WARN_COMMA = YES; 165 | CLANG_WARN_CONSTANT_CONVERSION = YES; 166 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 167 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 168 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 169 | CLANG_WARN_EMPTY_BODY = YES; 170 | CLANG_WARN_ENUM_CONVERSION = YES; 171 | CLANG_WARN_INFINITE_RECURSION = YES; 172 | CLANG_WARN_INT_CONVERSION = YES; 173 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 174 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 175 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 176 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 177 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 178 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 179 | CLANG_WARN_STRICT_PROTOTYPES = YES; 180 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 181 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 182 | CLANG_WARN_UNREACHABLE_CODE = YES; 183 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 184 | COPY_PHASE_STRIP = NO; 185 | DEBUG_INFORMATION_FORMAT = dwarf; 186 | ENABLE_STRICT_OBJC_MSGSEND = YES; 187 | ENABLE_TESTABILITY = YES; 188 | GCC_C_LANGUAGE_STANDARD = gnu11; 189 | GCC_DYNAMIC_NO_PIC = NO; 190 | GCC_NO_COMMON_BLOCKS = YES; 191 | GCC_OPTIMIZATION_LEVEL = 0; 192 | GCC_PREPROCESSOR_DEFINITIONS = ( 193 | "DEBUG=1", 194 | "$(inherited)", 195 | ); 196 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 197 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 198 | GCC_WARN_UNDECLARED_SELECTOR = YES; 199 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 200 | GCC_WARN_UNUSED_FUNCTION = YES; 201 | GCC_WARN_UNUSED_VARIABLE = YES; 202 | IPHONEOS_DEPLOYMENT_TARGET = 15.5; 203 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 204 | MTL_FAST_MATH = YES; 205 | ONLY_ACTIVE_ARCH = YES; 206 | SDKROOT = iphoneos; 207 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 208 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 209 | }; 210 | name = Debug; 211 | }; 212 | BA69D94928C128740087D2FE /* Release */ = { 213 | isa = XCBuildConfiguration; 214 | buildSettings = { 215 | ALWAYS_SEARCH_USER_PATHS = NO; 216 | CLANG_ANALYZER_NONNULL = YES; 217 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 218 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; 219 | CLANG_ENABLE_MODULES = YES; 220 | CLANG_ENABLE_OBJC_ARC = YES; 221 | CLANG_ENABLE_OBJC_WEAK = YES; 222 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 223 | CLANG_WARN_BOOL_CONVERSION = YES; 224 | CLANG_WARN_COMMA = YES; 225 | CLANG_WARN_CONSTANT_CONVERSION = YES; 226 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 227 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 228 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 229 | CLANG_WARN_EMPTY_BODY = YES; 230 | CLANG_WARN_ENUM_CONVERSION = YES; 231 | CLANG_WARN_INFINITE_RECURSION = YES; 232 | CLANG_WARN_INT_CONVERSION = YES; 233 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 234 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 235 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 236 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 237 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 238 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 239 | CLANG_WARN_STRICT_PROTOTYPES = YES; 240 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 241 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 242 | CLANG_WARN_UNREACHABLE_CODE = YES; 243 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 244 | COPY_PHASE_STRIP = NO; 245 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 246 | ENABLE_NS_ASSERTIONS = NO; 247 | ENABLE_STRICT_OBJC_MSGSEND = YES; 248 | GCC_C_LANGUAGE_STANDARD = gnu11; 249 | GCC_NO_COMMON_BLOCKS = YES; 250 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 251 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 252 | GCC_WARN_UNDECLARED_SELECTOR = YES; 253 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 254 | GCC_WARN_UNUSED_FUNCTION = YES; 255 | GCC_WARN_UNUSED_VARIABLE = YES; 256 | IPHONEOS_DEPLOYMENT_TARGET = 15.5; 257 | MTL_ENABLE_DEBUG_INFO = NO; 258 | MTL_FAST_MATH = YES; 259 | SDKROOT = iphoneos; 260 | SWIFT_COMPILATION_MODE = wholemodule; 261 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 262 | VALIDATE_PRODUCT = YES; 263 | }; 264 | name = Release; 265 | }; 266 | BA69D94B28C128740087D2FE /* Debug */ = { 267 | isa = XCBuildConfiguration; 268 | buildSettings = { 269 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 270 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 271 | CODE_SIGN_STYLE = Automatic; 272 | CURRENT_PROJECT_VERSION = 1; 273 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUIDragDropDemo/Preview Content\""; 274 | ENABLE_PREVIEWS = YES; 275 | GENERATE_INFOPLIST_FILE = YES; 276 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 277 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 278 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 279 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 280 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 281 | LD_RUNPATH_SEARCH_PATHS = ( 282 | "$(inherited)", 283 | "@executable_path/Frameworks", 284 | ); 285 | MARKETING_VERSION = 1.0; 286 | PRODUCT_BUNDLE_IDENTIFIER = com.SwiftUIDragDropDemo; 287 | PRODUCT_NAME = "$(TARGET_NAME)"; 288 | SWIFT_EMIT_LOC_STRINGS = YES; 289 | SWIFT_VERSION = 5.0; 290 | TARGETED_DEVICE_FAMILY = "1,2"; 291 | }; 292 | name = Debug; 293 | }; 294 | BA69D94C28C128740087D2FE /* Release */ = { 295 | isa = XCBuildConfiguration; 296 | buildSettings = { 297 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 298 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 299 | CODE_SIGN_STYLE = Automatic; 300 | CURRENT_PROJECT_VERSION = 1; 301 | DEVELOPMENT_ASSET_PATHS = "\"SwiftUIDragDropDemo/Preview Content\""; 302 | ENABLE_PREVIEWS = YES; 303 | GENERATE_INFOPLIST_FILE = YES; 304 | INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; 305 | INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; 306 | INFOPLIST_KEY_UILaunchScreen_Generation = YES; 307 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 308 | INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; 309 | LD_RUNPATH_SEARCH_PATHS = ( 310 | "$(inherited)", 311 | "@executable_path/Frameworks", 312 | ); 313 | MARKETING_VERSION = 1.0; 314 | PRODUCT_BUNDLE_IDENTIFIER = com.SwiftUIDragDropDemo; 315 | PRODUCT_NAME = "$(TARGET_NAME)"; 316 | SWIFT_EMIT_LOC_STRINGS = YES; 317 | SWIFT_VERSION = 5.0; 318 | TARGETED_DEVICE_FAMILY = "1,2"; 319 | }; 320 | name = Release; 321 | }; 322 | /* End XCBuildConfiguration section */ 323 | 324 | /* Begin XCConfigurationList section */ 325 | BA69D93728C128730087D2FE /* Build configuration list for PBXProject "SwiftUIDragDropDemo" */ = { 326 | isa = XCConfigurationList; 327 | buildConfigurations = ( 328 | BA69D94828C128740087D2FE /* Debug */, 329 | BA69D94928C128740087D2FE /* Release */, 330 | ); 331 | defaultConfigurationIsVisible = 0; 332 | defaultConfigurationName = Release; 333 | }; 334 | BA69D94A28C128740087D2FE /* Build configuration list for PBXNativeTarget "SwiftUIDragDropDemo" */ = { 335 | isa = XCConfigurationList; 336 | buildConfigurations = ( 337 | BA69D94B28C128740087D2FE /* Debug */, 338 | BA69D94C28C128740087D2FE /* Release */, 339 | ); 340 | defaultConfigurationIsVisible = 0; 341 | defaultConfigurationName = Release; 342 | }; 343 | /* End XCConfigurationList section */ 344 | }; 345 | rootObject = BA69D93428C128730087D2FE /* Project object */; 346 | } 347 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo.xcodeproj/xcuserdata/miznahalobaishy.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | SwiftUIDragDropDemo.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Blazed Croissant.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Screen Shot 2022-06-09 at 2.24.21 PM.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Blazed Croissant.imageset/Screen Shot 2022-06-09 at 2.24.21 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Blazed Croissant.imageset/Screen Shot 2022-06-09 at 2.24.21 PM.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Blazed Donouts.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Blazed Donouts.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Blazed Donouts.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Boston Donouts.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Boston Donouts.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Boston Donouts.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Chocolate Croissant.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Screen Shot 2022-06-09 at 2.24.59 PM.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Chocolate Croissant.imageset/Screen Shot 2022-06-09 at 2.24.59 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Chocolate Croissant.imageset/Screen Shot 2022-06-09 at 2.24.59 PM.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Cholocate Donouts.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Cholocate Donouts.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Cholocate Donouts.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Creamy Donouts.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Creamy Donouts.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Creamy Donouts.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Croissant with Nuts.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Screen Shot 2022-06-09 at 2.26.12 PM.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Croissant with Nuts.imageset/Screen Shot 2022-06-09 at 2.26.12 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Croissant with Nuts.imageset/Screen Shot 2022-06-09 at 2.26.12 PM.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Donouts with sparkles.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Donouts with sparkles.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Donouts with sparkles.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Latte Espresso.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Latte Espresso.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Latte Espresso.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Machhiato Espresso.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Machhiato Espresso.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Machhiato Espresso.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Mega Croissant.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Mega Croissant.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Mega Croissant.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Mocha Espresso.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Mocha Espresso.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Mocha Espresso.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Piccolo Latte Espresso.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Piccolo Latte Espresso.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Piccolo Latte Espresso.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Red Eye Espresso.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Red Eye Espresso.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Red Eye Espresso.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Ristretto Espresso.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Ristretto Espresso.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Ristretto Espresso.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Somatra Espresso.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Somatra Espresso.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Somatra Espresso.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Steamed Espresso.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Steamed Espresso.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Steamed Espresso.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Sugar Croissant.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Image.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/Sugar Croissant.imageset/Image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/Sugar Croissant.imageset/Image.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/coffeeBg.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "Screen Shot 2022-06-09 at 5.42.45 PM.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Assets.xcassets/coffeeBg.imageset/Screen Shot 2022-06-09 at 5.42.45 PM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TariqAlmazyad/SwiftUIDragDropDemo/e55a741208462039ba778b9ab01cfdc4510124a5/SwiftUIDragDropDemo/Assets.xcassets/coffeeBg.imageset/Screen Shot 2022-06-09 at 5.42.45 PM.png -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/ContentView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ContentView.swift 3 | // SwiftUIDragDropDemo 4 | // 5 | // Created by Tariq Almazyad on 01/09/2022. 6 | // 7 | 8 | import SwiftUI 9 | import UniformTypeIdentifiers 10 | final class DraggableGridViewModel: ObservableObject { 11 | @Published var foods: [FoodItem] 12 | @Published var selectedDraggingItem: FoodItem? 13 | @Published var columns: [GridItem] = Array(repeating: .init(.adaptive(minimum: 160, maximum: 200), 14 | spacing: 20, alignment: .top), count: 2) 15 | init(){ 16 | foods = [ 17 | .init(imageName: "Blazed Croissant", title: "Blazed Croissant", description: ""), 18 | .init(imageName: "Blazed Donouts", title: "Blazed Donouts", description: ""), 19 | .init(imageName: "Chocolate Croissant", title: "Chocolate Croissant", description: ""), 20 | .init(imageName: "Creamy Donouts", title: "Creamy Donouts", description: ""), 21 | .init(imageName: "Croissant with Nuts", title: "Croissant with Nuts", description: ""), 22 | .init(imageName: "Donouts with sparkles", title: "Donouts with sparkles", description: ""), 23 | .init(imageName: "Machhiato Espresso", title: "Machhiato Espresso", description: ""), 24 | .init(imageName: "Mocha Espresso", title: "Mocha Espresso", description: ""), 25 | ] 26 | } 27 | 28 | } 29 | 30 | struct ContentView: View { 31 | @StateObject var viewModel = DraggableGridViewModel() 32 | var body: some View { 33 | NavigationView{ 34 | ScrollView(.vertical, showsIndicators: false) { 35 | LazyVGrid(columns: viewModel.columns, spacing: 30) { 36 | ForEach($viewModel.foods) { $foodItem in 37 | VStack{ 38 | Image(foodItem.imageName) 39 | .resizable() 40 | .scaledToFill() 41 | .frame(width: 180, height: 200) 42 | .clipShape(RoundedRectangle(cornerRadius: 12)) 43 | Text(foodItem.title) 44 | .font(.system(size: 18, weight: .semibold, design: .rounded)) 45 | .foregroundColor(.orange) 46 | .multilineTextAlignment(.center) 47 | .minimumScaleFactor(0.6) 48 | Spacer() 49 | } 50 | .onDrag { 51 | self.viewModel.selectedDraggingItem = foodItem 52 | return NSItemProvider(object: String(foodItem.id) as NSString) 53 | } 54 | .onDrop(of: [UTType.text], 55 | delegate: OnDragDelegate(foodItem: foodItem,foods: $viewModel.foods, currentSelectedItem: $viewModel.selectedDraggingItem)) 56 | 57 | } 58 | }.animation(.spring(), value: viewModel.foods) 59 | .padding(.top, 34) 60 | }.onDrop(of: [UTType.text], delegate: OnDropDelegate(currentItem: $viewModel.selectedDraggingItem)) 61 | .navigationTitle("Draggable View") 62 | .navigationBarTitleDisplayMode(.large) 63 | } 64 | } 65 | } 66 | 67 | struct OnDropDelegate: DropDelegate { 68 | @Binding var currentItem: FoodItem? 69 | func performDrop(info: DropInfo) -> Bool { 70 | currentItem = nil 71 | return true 72 | } 73 | } 74 | 75 | struct OnDragDelegate: DropDelegate { 76 | let foodItem: FoodItem 77 | @Binding var foods: [FoodItem] 78 | @Binding var currentSelectedItem: FoodItem? 79 | 80 | func dropEntered(info: DropInfo) { 81 | if foodItem != currentSelectedItem { 82 | if let currentSelectedItem = currentSelectedItem { 83 | guard let fromIndex = foods.firstIndex(of: currentSelectedItem) else {return} 84 | guard let to = foods.firstIndex(of: foodItem) else {return} 85 | if foods[to].id != currentSelectedItem.id { 86 | foods.move(fromOffsets: IndexSet(integer: fromIndex), toOffset: to > fromIndex ? to + 1 : to) 87 | } 88 | } 89 | } 90 | } 91 | 92 | func dropUpdated(info: DropInfo) -> DropProposal? { 93 | return DropProposal(operation: .move) 94 | } 95 | 96 | func performDrop(info: DropInfo) -> Bool { 97 | self.currentSelectedItem = nil 98 | return true 99 | } 100 | } 101 | 102 | struct ContentView_Previews: PreviewProvider { 103 | static var previews: some View { 104 | ContentView() 105 | .preferredColorScheme(.dark) 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Model.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Model.swift 3 | // SwiftUIDragDropDemo 4 | // 5 | // Created by Tariq Almazyad on 01/09/2022. 6 | // 7 | 8 | import Foundation 9 | import SwiftUI 10 | 11 | struct FoodItem: Identifiable, Hashable, Equatable { 12 | let id: String = UUID().uuidString 13 | let imageName: String 14 | let title: String 15 | let description: String 16 | } 17 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/Preview Content/Preview Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /SwiftUIDragDropDemo/SwiftUIDragDropDemoApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SwiftUIDragDropDemoApp.swift 3 | // SwiftUIDragDropDemo 4 | // 5 | // Created by Tariq Almazyad on 01/09/2022. 6 | // 7 | 8 | import SwiftUI 9 | 10 | @main 11 | struct SwiftUIDragDropDemoApp: App { 12 | var body: some Scene { 13 | WindowGroup { 14 | ContentView() 15 | } 16 | } 17 | } 18 | --------------------------------------------------------------------------------