Vatsal Manot Vatsal Manot - 2 months ago 13
iOS Question

Can't access Swift class from custom dynamic framework (Swift)

My test dynamic iOS framework

XYZFramework
consists of a single class
XYZ
.

However, even after declaring:

import XYZFramework


I am unable to access this class, with any attempts yielding the following error:

Use of unresolved identifier 'XYZ'


How do I resolve this issue?

Answer

Found the answer. I had to prefix my class declaration with the public modifier. So this:

class XYZ
{

}

became:

public class XYZ
{

}

And as always, trashing the ~/Library/Developer/Xcode/DerivedData folder fixed any minor complications.

Comments