2019-11-21 03:28:24 +01:00
|
|
|
//
|
|
|
|
// MasterFeedViewController+Drag.swift
|
|
|
|
// NetNewsWire-iOS
|
|
|
|
//
|
|
|
|
// Created by Maurice Parker on 11/20/19.
|
|
|
|
// Copyright © 2019 Ranchero Software. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import MobileCoreServices
|
|
|
|
import Account
|
|
|
|
|
|
|
|
extension MasterFeedViewController: UITableViewDragDelegate {
|
|
|
|
|
|
|
|
func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
|
2020-06-16 01:03:20 +02:00
|
|
|
guard let identifier = dataSource.itemIdentifier(for: indexPath), identifier.isWebFeed, let url = identifier.url else {
|
2019-11-21 03:28:24 +01:00
|
|
|
return [UIDragItem]()
|
|
|
|
}
|
|
|
|
|
2020-06-16 01:03:20 +02:00
|
|
|
let data = url.data(using: .utf8)
|
2019-11-21 03:28:24 +01:00
|
|
|
let itemProvider = NSItemProvider()
|
|
|
|
|
2019-11-21 20:49:05 +01:00
|
|
|
itemProvider.registerDataRepresentation(forTypeIdentifier: kUTTypeURL as String, visibility: .ownProcess) { completion in
|
2019-11-21 03:28:24 +01:00
|
|
|
completion(data, nil)
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
let dragItem = UIDragItem(itemProvider: itemProvider)
|
2020-06-16 01:03:20 +02:00
|
|
|
dragItem.localObject = identifier
|
2019-11-21 03:28:24 +01:00
|
|
|
return [dragItem]
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|