{"id":13951062,"url":"https://github.com/cupnoodle/ADragDropView","last_synced_at":"2025-07-20T13:32:18.922Z","repository":{"id":56900290,"uuid":"150125756","full_name":"cupnoodle/ADragDropView","owner":"cupnoodle","description":"Add a Drag and drop view (swift) for your macOS app easily","archived":false,"fork":false,"pushed_at":"2019-04-11T18:14:51.000Z","size":317,"stargazers_count":46,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-17T21:18:43.250Z","etag":null,"topics":["drag-and-drop","drag-drop","macos"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cupnoodle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-24T15:34:15.000Z","updated_at":"2025-02-23T23:11:40.000Z","dependencies_parsed_at":"2022-08-21T02:20:41.518Z","dependency_job_id":null,"html_url":"https://github.com/cupnoodle/ADragDropView","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/cupnoodle/ADragDropView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupnoodle%2FADragDropView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupnoodle%2FADragDropView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupnoodle%2FADragDropView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupnoodle%2FADragDropView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cupnoodle","download_url":"https://codeload.github.com/cupnoodle/ADragDropView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cupnoodle%2FADragDropView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266135013,"owners_count":23881774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drag-and-drop","drag-drop","macos"],"created_at":"2024-08-08T06:01:12.294Z","updated_at":"2025-07-20T13:32:18.386Z","avatar_url":"https://github.com/cupnoodle.png","language":"Swift","funding_links":[],"categories":["Swift"],"sub_categories":[],"readme":"# ADragDropView\n\n[![Build Status](https://travis-ci.org/cupnoodle/ADragDropView.svg?branch=master)](https://travis-ci.org/cupnoodle/ADragDropView)\n\n\n\u003e Add a Drag and drop view (swift) for your macOS app easily\n\nI used this in my mac apps, [Pushever, test APNS push notification easily](https://itunes.apple.com/us/app/pushever-apns-tester/id1455738387?ls=1\u0026mt=12) and [PDF Page Numberer](https://pdfpagenumber.com).\n\n\n\n![Demo](demo.gif)\n\n\n\n## Requirements\n\n- macOS 10.12+\n- Xcode 9.4.1+\n- Swift 4.1+\n\n\n\n## Install\n\n### Manual\nCopy the `ADragDropView.swift` and `NSDraggingInfo+FilePathURL.swift` inside the `ADragDropView` folder to your project.\n\n\n\n### CocoaPods\n\n```ruby\npod 'ADragDropView'\n```\n\n\n\nOn the top of view controller, add\n\n```swift\nimport ADragDropView\n```\n\n\n\n\n\n## Usage\n\n*Run the `ADragDropViewExample` target in Xcode to try the demo.*\n\n\n\nDrag and drop a **Custom View** to your view controller in Interface Builder, set its class to **ADragDropView** and create an IBOutlet for it.\n\n![custom view](customView.png)\n\n\n\n![custom class](customClass.png)\n\n\n\nSet delegate (usually to the view controller), `dragDropView.delegate = self` . \n\nSet the allowed file extensions: `dragDropView.acceptedFileExtensions = [\"png\", \"jpg\", \"jpeg\", \"gif\"]` .\n\n\n\nImplement the two delegate methods to handle dropped file(s) :  \n\n```swift\nextension ViewController: ADragDropViewDelegate {\n    // when one file is dropped\n    func dragDropView(_ dragDropView: ADragDropView, droppedFileWithURL URL: URL) {\n        \n        // action to do when the file is dropped\n    }\n    \n    // when multiple files are dropped\n    func dragDropView(_ dragDropView: ADragDropView, droppedFilesWithURLs URLs: [URL]) {\n        \n       // action to do when the files are dropped\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcupnoodle%2FADragDropView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcupnoodle%2FADragDropView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcupnoodle%2FADragDropView/lists"}