• 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: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?


  • Subject: Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
  • From: Quincey Morris <email@hidden>
  • Date: Mon, 15 Jun 2015 17:39:38 +0000

On Jun 15, 2015, at 10:17 , has <email@hidden> wrote:
>
> the goal is to enable a user to print an object specifier and be able to copy-and-paste that straight into another script -  i.e. `-description` should always return a string that represents valid Swift code

I dunno about #1 or #2, but for #3 look into the “Custom…” family of protocols, especially ‘CustomStringConvertible’, which is the one that defines ‘description’ and ‘debugDescription’ as having more-or-less their Obj-C meanings. IIRC, CustomStringConvertible is also the one that allows your custom type to participate in string interpolation: “\(variableOfYourType)”, which would connect you with what I assume you mean by “printing".

The standard protocols are all documented in the Swift Standard Library document for Swift 2. It’s worth browsing the list to see if there’s other stuff that might be helpful. Any of the “…Convertible” protocols might open up possibilities for streamlining your invocation syntaxes.

HTH



_______________________________________________

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


  • Follow-Ups:
    • Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
      • From: has <email@hidden>
References: 
 >[Swift] best way to support 'keyword' args, symbolic values, show values as literals? (From: has <email@hidden>)

  • Prev by Date: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
  • Next by Date: Re: Language options: Objective-C, Swift, C or C++?
  • Previous by thread: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
  • Next by thread: Re: [Swift] best way to support 'keyword' args, symbolic values, show values as literals?
  • Index(es):
    • Date
    • Thread