“Use of undeclared type” in the same bundle that declares the type.

This is a Cocoa + Swift issue.


i have an NSObject subclass defined in the main app Bundle:

open class BKLayerProperties : NSObject, NSSecureCoding{


I am setting this object as the represented object in a CollectionViewItem. I need to get to it’s properties, and that works ok so long as I am binding and it’s to individual properties. But Now I am adding support for a detail interface… a table view that addresses an array of items in the class.


first, the array Controller hooked up in IB errored out, complaining that it coud find no object by the name of my class. here’s the declaration for that class:

open class BKConstraintDefinition : NSObject, NSSecureCoding{


so no big deal. I’ll just make a custom Collection View Item, and build the object in code, and insert it myself into the array…

and here’s where everything went over the cliff.


I built my CollectionViewItem, and decided I needed a convenience variable :

    var props : BKLayerProperties{
        return self.representedObject as! BKLayerProperties


…so that I don’t have to convert the represented object all the time, and this code returns this error:

Use of undeclared type ‘BKLayerProperties’


here’s the problem: it IS Declared. It is declared in the same Bundle, and I’ve added the @objc(classname)  line just so that we can all know without any doubts that this class should be available to IB, and OTHER classes in the same bundle. It’s set to be open, and should already be available. As I said… binding to properties in that very class… that works. So we know that I have an object, and the class type is not in dispute. But we have some serious problems, and I’m out of ideas. This should be working. I should not be seeing these errors. What could possibly explain why an Open class unfindable by other open classes in the same bundle?

Powered by WPeMatico

You may also like...

Comments are closed.