2019-11-21 03:28:24 +01:00
|
|
|
//
|
2024-02-26 17:37:15 +01:00
|
|
|
// FeedViewController+Drag.swift
|
2019-11-21 03:28:24 +01:00
|
|
|
// NetNewsWire-iOS
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 11/20/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import MobileCoreServices
|
|
|
|
import Account
|
2024-02-26 03:42:26 +01:00
|
|
|
import UniformTypeIdentifiers
|
2019-11-21 03:28:24 +01:00
|
|
|
|
2024-03-04 07:51:53 +01:00
|
|
|
extension SidebarViewController: UITableViewDragDelegate {
|
2019-11-21 03:28:24 +01:00
|
|
|
|
|
|
|
func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
|
2024-02-26 08:12:21 +01:00
|
|
|
guard let node = coordinator.nodeFor(indexPath), let feed = node.representedObject as? Feed else {
|
2019-11-21 03:28:24 +01:00
|
|
|
return [UIDragItem]()
|
|
|
|
}
|
|
|
|
|
2024-02-26 08:12:21 +01:00
|
|
|
let data = feed.url.data(using: .utf8)
|
2019-11-21 03:28:24 +01:00
|
|
|
let itemProvider = NSItemProvider()
|
|
|
|
|
2024-02-26 03:42:26 +01:00
|
|
|
itemProvider.registerDataRepresentation(forTypeIdentifier: UTType.url.identifier, visibility: .ownProcess) { completion in
|
2019-11-21 03:28:24 +01:00
|
|
|
completion(data, nil)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
let dragItem = UIDragItem(itemProvider: itemProvider)
|
2021-10-21 02:03:02 +02:00
|
|
|
dragItem.localObject = node
|
2019-11-21 03:28:24 +01:00
|
|
|
return [dragItem]
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|