Import Swift framework in Swift: "Use of undeclared type 'MyCustomView'" Import Swift framework in Swift: "Use of undeclared type 'MyCustomView'" ios ios

Import Swift framework in Swift: "Use of undeclared type 'MyCustomView'"


You should mark the class as public since it is part of different framework module

@IBDesignable public class MyCustomView: UIView {}

By default classes and methods will be at internal access level. If you want to use that out side of that target you should mark it as public. Then only it will be the part of public interface(visible to outside of target)


I faced the same error after importing my custom framework A inside another project B, even all my classes were public.

I solved it by changing the Building settings of my custom framework A at Build Active Architecture only to No instead of Yes, then clean compile, and reimport the framework again after deleting the old one.

Then everything compiled successfully.


matomo