• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to Extend Swift Dictionary?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >How to Extend Swift Dictionary? (From: Charles Jenkins <email@hidden>)

  • Prev by Date: How to Extend Swift Dictionary?
  • Next by Date: All of a sudden, app security exception?
  • Previous by thread: How to Extend Swift Dictionary?
  • Next by thread: All of a sudden, app security exception?
  • Index(es):
    • Date
    • Thread