Was SE-0057 fully implemented in Swift 3?


(Ben Pious) #1

Hello all,

SE-0057 <https://github.com/apple/swift-evolution/blob/master/proposals/0057-importing-objc-generics.md> describes a method for bridging generics in to Objective-C which opt into type discovery by implementing -classForGenericArgumentAtIndex or +classForGenericArgumentAtIndex, and gives a number of examples using GameKit. However, the examples in SE-0057 don’t actually work in Swift 3. I can’t get the examples to work with the GameKit classes (which actually do implement those two methods in the iOS 10 SDK) or with my own Objective-C classes; they both fail with “Extension of a generic Objective-C class cannot access the class’s generic parameters at runtime.”

I searched the Swift bug tracker, and didn’t find anything about it. Will this feature be added in a future version of Swift?

Ben Pious