Question about SE-0057 "Importing Objective-C Lightweight Generics"


(Michael Peternell) #1

https://github.com/apple/swift-evolution/blob/master/proposals/0057-importing-objc-generics.md

How can Swift know if an Objective-C class implements +/- classForGenericArgumentAtIndex: at compile time? Does it look at the object code? Or does it look at the header file? Or maybe there is a third option?

I'm asking, because this may lead to misunderstandings if the method needs to be there in the header file, but Objective-C programmers are not aware that they have to declare that method.

-Michael


(Joe Groff) #2

It needs to be present in the header at compile time.

-Joe

ยทยทยท

On Apr 14, 2016, at 2:06 PM, Michael Peternell via swift-evolution <swift-evolution@swift.org> wrote:

https://github.com/apple/swift-evolution/blob/master/proposals/0057-importing-objc-generics.md

How can Swift know if an Objective-C class implements +/- classForGenericArgumentAtIndex: at compile time? Does it look at the object code? Or does it look at the header file? Or maybe there is a third option?

I'm asking, because this may lead to misunderstandings if the method needs to be there in the header file, but Objective-C programmers are not aware that they have to declare that method.