Obj-C imported `open` class impossible to subclass properly

I tried to subclass CIDetector which is imported as open:

open class CIDetector : NSObject {

but quickly realised it's not possible to do it properly so I could call though the super initialiser:

    public /*not inherited*/ init?(ofType type: String, context: CIContext?, options: [String : Any]? = nil)

because the corresponding Obj-C API is a static method:

+ (nullable CIDetector *)detectorOfType:(NSString*)type
                                context:(nullable CIContext *)context
                                options:(nullable NSDictionary<NSString *,id> *)options

I guess /*not inherited*/ comment is added automatically by the importer, rather than being done by hand (right?).

Shouldn't such a class be (automatically) imported as public instead of open? Or, perhaps annotated in Obj-C manually in such a way that it is imported in Swift as non-open? Do we already have such annotation and it's just a matter for Core Image maintainers to annotate this class properly?

1 Like