[swift-evolution] [Proposal] Revamp the playground quicklook APIs

Ian Partridge ian at poncho.org.uk
Wed Jan 10 03:58:31 CST 2018

On 9 January 2018 at 23:19, Connor Wakamo via swift-evolution
<swift-evolution at swift.org> wrote:
> To that end, I am proposing the following:
> - Introduce a new protocol, CustomPlaygroundRepresentable, in the
> PlaygroundSupport library in Swift 4.1:
> protocol CustomPlaygroundRepresentable {
> /// Returns an alternate object or value which should stand in for the
> receiver in playground logging, or nil if the receiver’s default
> representation is preferred.
> var playgroundRepresentation: Any? { get }
> }

I was always surprised that "Playground" was a word/concept that the
Standard Library used, as playgrounds are an Xcode feature and iOS app
which are not part of the Swift open source project.

I think it might be better if names for these could be found which
reflect the functionality they provide, in a non "playground" specific
way. After all, AFAIK it would be possible for non-"playground" uses
of CustomPlaygroundRepresentable.

Ian Partridge

More information about the swift-evolution mailing list