On Jun 15, 2015, at 10:17 , has <hengist.p...@virgin.net> 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 (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