VLCMediaData+VLCDragAndDrop.swift 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*****************************************************************************
  2. * VLCMediaData+VLCDragAndDrop.swift
  3. * VLC for iOS
  4. *****************************************************************************
  5. * Copyright (c) 2017 VideoLAN. All rights reserved.
  6. * $Id$
  7. *
  8. * Authors: Carola Nitz <caro # videolan.org>
  9. *
  10. * Refer to the COPYING file of the official project for license.
  11. *****************************************************************************/
  12. import Foundation
  13. @available(iOS 11.0, *)
  14. extension VLCMediaDataSource: VLCDragAndDropManagerDelegate {
  15. func dragAndDropManagerRequestsFile(manager: VLCDragAndDropManager, atIndexPath indexPath: IndexPath) -> AnyObject? {
  16. return object(at: indexPath.row, subcategory: manager.mediaType.subcategory)
  17. }
  18. func dragAndDropManagerInsertItem(manager: VLCDragAndDropManager, item: NSManagedObject, atIndexPath indexPath: IndexPath) {
  19. if item as? MLLabel != nil && indexPath.row < numberOfFiles(subcategory: manager.mediaType.subcategory) {
  20. removeObject(at: indexPath.row, subcategory: manager.mediaType.subcategory)
  21. }
  22. insert(item as! MLFile, at: indexPath.row, subcategory: manager.mediaType.subcategory)
  23. }
  24. func dragAndDropManagerDeleteItem(manager: VLCDragAndDropManager, atIndexPath indexPath: IndexPath) {
  25. return removeObject(at: indexPath.row, subcategory: manager.mediaType.subcategory)
  26. }
  27. func dragAndDropManagerCurrentSelection(manager: VLCDragAndDropManager) -> AnyObject? {
  28. // TODO: Handle playlists and Collections
  29. fatalError()
  30. }
  31. func dragAndDropManagerRemoveFileFromFolder(manager: VLCDragAndDropManager, file: NSManagedObject) {
  32. // TODO: handle removing from playlists and Collections
  33. fatalError()
  34. }
  35. }