Hi,

Maybe this has been asked before but I couldn't find it.

I would like to be able to give visibility of non-generic subclass of a
generic class to obj-c. Is there any limitation of the compiler knowing
that the type of the non-generic type is closed, to generate a compatible
version for obj-c?

Code Example:

class SwiftSuperType<T: NSObjectProtocol> : NSObject {

}

class NonGenericClass2: SwiftSuperType<NSObject> {

}

Or with a obj-c super class:

@interface ObjcSuperType<T: id<NSObject>> : NSObject

@end

class NonGenericClass: ObjcSuperType<NSObject> {

}


Actual Behaviour:

Non-generic classes are not visible in obj-c. If adding the @objc notation
we get the following error.

Actual error message:
Generic subclasses of '@objc' classes cannot have an explicit '@objc'
attribute because they are not directly visible from Objective-C

regards,

--
Davide Mendolia
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to