Skip to content

Instantly share code, notes, and snippets.

@robertmryan
Last active February 28, 2016 23:18
Show Gist options
  • Select an option

  • Save robertmryan/625b2e279a8f013c23e9 to your computer and use it in GitHub Desktop.

Select an option

Save robertmryan/625b2e279a8f013c23e9 to your computer and use it in GitHub Desktop.
func myFunction() -> NSArray {
var array: NSArray
Synchronized(someObject) {
// Stuff to do.
// don't "return" the array, here, but just set that local var above
}
return array // you can only "return" the `NSArray` object from outside the `Synchronized` closure
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment