Use of undeclared type (kUTTypeUTF8PlainText)

Using the following class as an example. Trying to add the new 'Drag and Drop' functionality to an existing Collection View. My model was a 'struct', and I'm trying to change it to a 'class'. Following the WWDC 2017 #227 - Data Delivery with Drag and Drop video, I cannot get the UTI to take.


import MobileCoreServices

class NumberStore1: NSObject, NSItemProviderReading {
    var number: String
    var isPurged: Int
    var isSelected: Int = 0
    // next line has error in Xcode: Use of undeclared type 'kUTTypeUTF8PlainText'
    static var readableTypeIdentifiersForItemProvider: [kUTTypeUTF8PlainText as String]
    required init(itemProviderData data: Data, typeIdentifier: String) throws {
        super.init()

    }
    static func object(withItemProviderData data: Data, typeIdentifier: String) throws -> Self {

    }
}


I imported the MobileCoreServices framework, and still cannot get Xcode to accept the type.


Ideas to fix appreciated

>I imported the MobileCoreServices framework


Adding and importing are two separate things, and you need to do both - assuming you meant you 'added' the framework to your project, show where this line is in your code...


#import <MobileCoreServices/MobileCoreServices.h>



If you actually meant that you imported and that line is where it should be, then you need to add the framework - see Xcode Help for that process.


I think the error means you need to add that line of code, tho.


I'd also perform an option-clean build folder once those are done.

Use of undeclared type (kUTTypeUTF8PlainText)
 
 
Q