[swift-users] extension Dictionary where Key == MyStructType

Darren Mo darren.mo at me.com
Wed Jan 27 14:16:58 CST 2016


I want to add a method to Dictionary but only if the key is a specific non-protocol type.

I tried:
extension Dictionary where Key == MyStructType

This yields “error: same-type requirement makes generic parameter 'Key' non-generic”.

Is there a way to do this that doesn’t involve subclassing Dictionary?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160127/08eea949/attachment.html>


More information about the swift-users mailing list