iOS 11.x Swift 4
Trying to implement a custom class for using the new drop and drag protocol and need some super-coder help. I created this class.
import
The error message is correct and your line:
let itemProvider = NSItemProvider(object: customClass)
is incorrect for the reason stated. The object
parameter is expecting an instance of some class that conforms to the NSItemProviderWriting
protocol. But you are passing in an actual class, not an instance of the class.
Replace customClass
with an actual instance of your customClass
. If this method is inside your customClass
, then pass self
.
let itemProvider = NSItemProvider(object: self)
BTW - this would be less confusing if your followed standard naming conventions. Class and struct names should begin with uppercase letters. Variable and method names start with lowercase letters. So your customClass
should be named CustomClass
.