That’s correct, the .dmg is barely cold and we’re already using the xcode 6.3 beta. With it, we’re happy to report vastly reduced SourceKit crashes, which makes editing scenes from within Xcode actually possible now.

The second thing is some minor changes1 to syntax.

For the time being, it seems that trailing closures no longer behave the way they used to, so the syntax for adding Gestures and Animations is changing until that regression is fixed. Here is a diff of the old and new syntax (the red lines are the old way):


-  cloud.gestures.append(PanGesture { _, centroidSequenc in
+  cloud.gestures.append(PanGesture( handler: { _, centroidSequenc in
           var finger: Point = centroidSequenc.currentSample.globalLocation
           self.cloudLayer.x = finger.x
           self.rainEmitter?.x = finger.x
-  })
+  })) // <-- notice the  trailing ")"

the handler: label isn’t strictly necessary, you can optionally write PanGesture({_ in println("")}) if that makes things easier for you.


Dynamic animators are unaffected, but the traditional animators require passing the closure as an explicit argument to Layer.animateWithDuration. Here’s an example

-     Layer.animateWithDuration(0.35, curve: .EaseInOut) {
+     Layer.animateWithDuration(0.35, curve: .EaseInOut, animations: {
           self.spinnyLayer.rotationDegrees = 0
-     }
+     }) // <-- notice the  trailing ")"

Other bits we learned

One of the most befuddling changes was that members of @objc private classes now need to be explicitly tagged @objc individually. For example, ohaiprototope’s scene view controller’s data source was giving the useless “Type does not conform to protocol UITableViewDataSource” error even though it was implementing all the required methods.

There’s an even more insidious error which Andy points out: if the methods are optional then this will casually break silently leaving you scratching your head. If you’re updating any objc classes from swift, take a look to see if you’ve done the requisite lambada.

For the required UITableViewDataSource file, The fix was to make this change:

-@objc private class SceneListingDataSource: NSObject, UITableViewDataSource {
+private class SceneListingDataSource: NSObject, UITableViewDataSource {
        var scenes: [Scene]
        init(scenes: [Scene]) {
                self.scenes = scenes

-       private func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+       @objc private func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
                return scenes.count

-       private func numberOfSectionsInTableView(tableView: UITableView) -> Int {
+       @objc private func numberOfSectionsInTableView(tableView: UITableView) -> Int {
                return 1

Also new: Video and VideoLayer

If you’ve made it this far… There’s been some recent work to add videos to prototope. This works in two ways, the first is a Video object and a VideoLayer which contains and displays the video. Here’s an example from ohaiprototope:

let video: Video!
let videoLayer: VideoLayer

video = Video(name: "jeff.mp4")

videoLayer = VideoLayer(parent: Layer.root, video: video)

videoLayer.size = Size(width: 400, height: 300)
videoLayer.position = Position(x: 200, y: 200)

You can look forward to updated docs for that and more in the coming days.

In closing

Beyond that, we have some upcoming changes in the next week or so that should make sketching much faster, but for now enjoy the increased stability! Thanks for riding along the prototrain!

a valentine with a smiling saying 'i choo-choo-choose you.'

Thanks to desmond, andy, and nacho for looking this post over.

  1. if you’re curious about the trailing closure issue, take a look at this tweet (whose conversation indicates that this is probably an unexpected regression).