Skip to content
In this project I will be experimenting with Apple's Drag and Drop API and using it along with other APIs including but not limited to URLSession to create a drag and drop interface to download content from the web.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
TestingDragDrop
README.md

README.md

Drag-DropDownload

In this project I will be experimenting with Apple's Drag and Drop API and using it along with other APIs including but not limited to URLSession to create a drag and drop interface to download content from the web.

v1.0 - January 13th 2019

  • Populating a UITableView with simple model class and then using UITableViewDragDelegate to get the ball rolling.
  • Making a UIView a drop destination for the drag items using UIDropInteractionDelegate.
  • Counting the number of items dropped on the destination view / and using UIDropInteractionDelegate methods.

UPDATE: January 20th 2019

  • Populated a table view with podcasts from iTunes Search API

  • Fetched the podcast collection name, feedURL as well as the podcast artwork.

  • set up a class for the model and used Codable, NSItemProviderWriting and NSItemProviderReading to create a custom item provider.Several Apple provided classes already conform to these protocols such as UIImage, UIColor, NSURL, NSAttributedString and NSString. However, in order to create a custom item provider wrapper for your own model class you need to conform to NSItemProviderWriting and NSItemProviderReading.

  • We will be dragging our model object as 'KUTTypeData' by first encoding it to JSON (implemented in NSItemProviderWriting method) and then decoding it back to the model type (implemented in NSItemProviderReading method) when dropped. For this encoding and decoding we are using Codable. When creating drag item, we are using item provider which is constructed by using the object of the model class

      let podcastItem = PodcastModelData(collectionName: collectionName, feedURL: feedUrl, artworkURL100: artworkurl)
      let itemProvider = NSItemProvider(object: podcastItem)
      let dragItem = UIDragItem(itemProvider: itemProvider)
    
  • Drop the select podcasts on a custom view which will then take you to a new table view controller and populate the table.

Coming up next:

  • Animations
You can’t perform that action at this time.