On Fri, Mar 27, 2015, at 05:16 AM, Charles Jenkins wrote:
> Does anyone know of a good tutorial on how to extend the generic
> dictionary class in Swift? I can add whatever I want to a typed
> dictionary, but I haven’t figured out the right syntax to add extensions
> generically.

The type parameters from the initial declaration are visible within an
extension, even without adding type parameters to the extension
declaration:

  1> extension Dictionary { 
  2.     func doSomething(e: Value) -> () { 
  3.       // note that Value here is the same as Dictionary<Key, Value>
  4.     } 
  5. } 

If you find this confusing, please file a Radar.

--Kyle Sluder

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to