I'm trying to fix all my warnings for my project, but I can't seem to figure out how to do this.
The warning I am given is:
'sourceView' was deprecated in iOS 13.0: renamed to 'UIContextMenuInteraction'
I have read the documentation here but i still cant figure out how to fix this warning?
Here is the code it is talking about:
extension CollectionsViewController: UIViewControllerPreviewingDelegate {
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
let tableView = previewingContext.sourceView as! UITableView
if let indexPath = tableView.indexPathForRow(at: location) {
let cell = tableView.cellForRow(at: indexPath) as! CollectionCell
let touch = cell.convert(location, from: tableView)
if let productResult = cell.productFor(touch) {
previewingContext.sourceRect = tableView.convert(productResult.sourceRect, from: cell)
return self.productDetailsViewControllerWith(productResult.model)
} else if let collectionResult = cell.collectionFor(touch) {
previewingContext.sourceRect = tableView.convert(collectionResult.sourceRect, from: cell)
return self.productsViewControllerWith(collectionResult.model)
}
}
return nil
}
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
self.navigationController!.show(viewControllerToCommit, sender: self)
}
}
Any help would be greatly appreciated!