I have a tvOS project contains an App target and 3 static libraries:
EntryPoint – Static library that contains main , AppDelegate and SceneDelegate
Experience – Static library containing my UI elements
AppTarget – executable built using above two libraries
I have a class "SelectionTable" which subclasses UITableView in Experience target :
import UIKit
class SelectionTable : UITableView
{
private var vDataSrc:[String]!
func SetDataSrc (_ pDataSrc:[String])
{
self.vDataSrc = pDataSrc
}
func UpdateDataSrc (_ pStringList:[String])
{
self.vDataSrc += pStringList
}
func GetDataSrc () -> [String]
{
return self.vDataSrc
}
}
I am not using this class anywhere and still i am getting these errors when i build my AppTarget:
Cannot find interface declaration for 'UITableView', superclass of 'SelectionTable'
Expected a type
These above error are coming in generated header file "Experience-Swift.h". This file is auto-generated by compiler. I am not using @objc anywhere in the code, But still the Target-Swift.h file has the below lines:
SWIFT_CLASS("_TtC10Experience22SelectionTable")
@interface SelectionTable : UITableView
- (nonnull instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style OBJC_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
@end
When i am marking above class as Private , this error goes away .
And also , if i am defining SelectionTable class in EntryPoint library , this error does not occur .
I am using similar model for an iOS project also and there i am not facing this issue.
I am using :- Swift version : Swift 5.9.2 XCode version : 15.2