Use of undeclared type in Swift from Objective-C

If you are running into the error of “Use of undeclared type” trying to use an Objective-C object in Swift, then the problem might be due to the bridging header between Swift and Objective-C not actually working properly. When you use the bridging header between Swift and Objective-C to import Objective-C objects into Swift the objects aren’t always imported properly all the time. Instead this “problematic” import may lead to some Objective-C objects being imported into the Swift class you are using and not others, leading to the “Use of undeclared type” problem with Objective-C objects.

How to resolve this when you are having this problem is to import the framework again from Swift. This will do a proper import of the Objective-C class and the “Use of undeclared type” problem should disappear from your iOS program. See the video below for more details.

Chad is the CEO and founder at Push and was a former Apple Engineer before returning to Saskatchewan to revolutionize the mobile development world. Chad is passionate about creating efficient, well-designed software. Chad knows that people care about their mobile experience and Push is here to give them that great experience.

Leave a Reply

Your email address will not be published. Required fields are marked *