Re: How to Extend Swift Dictionary?
Re: How to Extend Swift Dictionary?
- Subject: Re: How to Extend Swift Dictionary?
- From: Kyle Sluder <email@hidden>
- Date: Fri, 27 Mar 2015 09:23:22 -0600
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 (email@hidden)
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:
This email sent to email@hidden