[swift-users] Any reason of "@objc is not supported within extensions of generic classes." ?

Zhao Xin owenzx at gmail.com
Wed Aug 24 09:23:37 CDT 2016


I was trying to implement a final class to conform NSCopying by extension.
List<T> was a class in Realm object database.

final class List<T>

My implementation:

extension List:NSCopying {
    public func copy(with zone: NSZone? = nil) -> Any {
        ...
    }
}

I got an error called "@objc is not supported within extensions of generic
classes.". Any idea why there is a limitation of this? Thanks.

Zhaoxin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160824/717a0eb2/attachment.html>


More information about the swift-users mailing list