Can't access class from custom dynamic framework (Swift)
12,089
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.
Author by
Vatsal Manot
Updated on June 05, 2022Comments
-
Vatsal Manot almost 2 years
My test dynamic iOS framework
XYZFramework
consists of a single classXYZ
.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?
-
mash over 9 yearsAfter I did add "public" to everything, quit Xcode, remove ~/Library/Developer/Xcode/DerivedData, relaunch Xcode and errors disappeared.
-
naz over 9 yearsI forget this part everytime...grrrrr
-
John Shammas about 9 yearsOld thread but one note: Instead of deleting that folder, I found that switching my scheme to the framework and running a build, then switching the scheme back to my app and running a build, accomplishes the same refresh.
-
eilas almost 7 years"trashing the ~/Library/Developer/Xcode/DerivedData" did the trick for me, thanks!
-
Alix over 6 yearsDo you mind posting your test project on github. I am trying to make framework. and I am getting the same sort of issue. classes and func are not accessible in the separate test project that I am creating.
-
Naresh over 2 yearsAnd also check SDK min. support version and your app main target support version.