Mistake in Apple's Crustacean.playground?

I had a look at the Crustacean.playground (which demonstrates protocol oriented programming), available here:

https://developer.apple.com/swift/resources/


It's a great demonstration but it seems to contain a small mistake in that it says:

// Note: the fact that "rectangleAt" doesn't appear below, but
// "circleAround" does, serves as a demonstration of how dispatching through
// protocols works: methods in protocol extensions that don't match a
// requirement (such as rectangleAt) are dispatched statically.


It is true that "rectableAt" appears above and not below, but there is no "circleAround" at all in the output, and there isn't even any circleAround method, just circleAt, which is not appearing anywhere in the output either.


Tell me if I'm misunderstanding something, or please correct this otherwise great playground.

It looks like 'circleAt' used to be called 'circleAround' but they forgot to change the comments when they renamed the method.

It's not only that, it's also that it says:

// Note: the fact that "rectangleAt" doesn't appear below, but 
// "circleAround" does, /.../

while neither circleAround nor circleAt are to be seen anywhere in the output.

Yes, "circleAround" is a typo—it should be "circleAt"—and the following requirement is missing from Renderer on page 2:


  /// Draws a complete circle with the given center and radius.
  ///
  /// Note: a default implementation of `circleAt` is provided by a
  /// protocol extension, so conforming types need not supply their own.
  func circleAt(center: CGPoint, radius: CGFloat)


Sorry for the inconvenience; we'll try to push an update out ASAP.

This should be fixed now, please re-download the playground.

I was taking a look at the Crustacean.playground today in Xcode 9, and it needed some updates for Swift 4.0.


I've uploaded my changes to github for anyone who needs them:


https://github.com/Krishna/Crustacean---Protocol-Oriented-Programming-in-Swift

I've translated Crustacean to a macos project (3 versions)


1) using a storyboard created NSView that implements the renderer protocol

2) a version that programatically creates the window to draw in

3) using a storyboard created NSView that gets the drawing via the cgcontext that implements the protocol


https://github.com/edwardvoss/swift-projects

Mistake in Apple's Crustacean.playground?
 
 
Q