[swift-corelibs-dev] NSCoding methods
phausler at apple.com
Fri Dec 25 12:46:08 CST 2015
Likely we will have to change that signature to instead of being NSSet and Set<NSObject> respectively to be more compatible; however this will be an API change. It might be good to mock up a swift translation layer for these APIs to simulate what it would be like on Darwin if we altered these to be renamed in swift and presented with a better interface via the SDK overlays. Note: this will have to go through our evolution proposal system and be weighed in by the component owners of NSKeyedArchiver and the API teams associated with that to make such a change.
In my opinion since AnyClass should be unique it by nature should be Hashable - however I am not certain we can actually do that without language changes.
Perhaps for the time being we could alter the signatures to be:
public func decodeObjectOfClasses(classes: [AnyClass], forKey key: String) -> AnyObject?
public var allowedClasses: [AnyClass]?
> On Dec 25, 2015, at 2:01 AM, Luke Howard via swift-corelibs-dev <swift-corelibs-dev at swift.org> wrote:
> Looking at decodeObjectOfClasses/allowedClasses – what is the element type in the set of allowed classes? It seems like it should be AnyClass but that can’t be added to a Set because it doesn’t implement Hashable (nor to an NSSet because the initialiser unconditionally casts to NSObject).
> — Luke
> swift-corelibs-dev mailing list
> swift-corelibs-dev at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-corelibs-dev