Search code examples
swiftpeek

Type 'MainVC' does not conform to protocol 'UIViewControllerPreviewingDelegate'


I don't know what I'm doing wrong, but my class MainVC can't conform to the protocol UIViewControllerPreviewingDelegate. I've searched all over the internet but couldn't find a single person who had the same issue.

This is my class:

class MainVC: UIViewController, UITableViewDelegate, UITableViewDataSource, UIViewControllerPreviewingDelegate {}

Is it because of another protocol?

I'm trying to peek from a cell in a tableView. The view is build in Storyboard.

I'm using Xcode 7.2.1 and Swift 2.2.


Solution

  • "Class conforms to protocol" means "class implements methods declared in this protocol". As we can see here, your protocol has 2 required methods. If you implement them (or at least create stubs, i.e. empty methods), compiler will not complain no more.