Skip to content

Instantly share code, notes, and snippets.

@tonyarnold
Created November 23, 2014 12:33
Show Gist options
  • Save tonyarnold/4db0546cfbcceccf5c8f to your computer and use it in GitHub Desktop.
Save tonyarnold/4db0546cfbcceccf5c8f to your computer and use it in GitHub Desktop.
Demonstrates a bug in Xcode 6.1.1 when trying to call super within a closure.
import Cocoa
class CocoaBotsDocument : NSDocument {
override func saveToURL(url: NSURL, ofType typeName: String, forSaveOperation saveOperation: NSSaveOperationType, completionHandler: (NSError!) -> Void) {
performAsynchronousFileAccessUsingBlock() { fileAccessCompletionHandler in
// I should be able to call:
super.saveToURL(url, ofType: typeName, forSaveOperation: saveOperation) { error in }
// And this _looks_ like it should work, but doesn't:
NSDocument.saveToURL(self)(url, ofType: typeName, forSaveOperation: saveOperation) { error in }
}
}
}
// There is no sadness like the death of optimism
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment