Kodeco Forums

Video Tutorial: Introducing Concurrency Part 1: NSOperation

Learn about what an NSOperation is, and how you can create and run them.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4034-introducing-concurrency/lessons/2

Hi @samdavies

I have a problem with the NSBlockOperation.
In the video you are referring to a result property when you’re writing

let summationOperation = NSBlockOperation(block: {
    result = 2 + 3
})

But Xcode does not recognize the ‘result’ property you’re referring to, I cant find it in the docs as well


Any suggestions?

Best,

Eran Artzi

Hi,

The result property is a variable that has been declared in the outer scope - for example:

var result: Int = 0
let summationOperation = NSBlockOperation(block: {
  result = 2 + 3
})

It’s not a special value or anything - and doesn’t represent best practice. It’s just a demo to get the concept of NSBlockOperation out quickly.

Hope that helps

sam

Oh
got it,

Thanks!

Hi @samdavies Thank you for this tutorial. I have a problem with workspace file. I opened workspace file and clicked playground file inside of it. But it says “No such module Compressor” I searched google i do some solutions but it doesnt work anyway.

Hi @ratel,

Can you try selecting the Compressor target and building? The first time you open the workspace you have to build the Compressor library in order that the playground can “see” it.

sam

Thank you for quick reply @samdavies ! I have tried as you say but result is same. Also all of challange and demo projects still 2.0 It is hard to refactor :confused:

@ratel

Oh, that’s a shame - sorry. Not sure what else to suggest.

There is a much improved update in the works, currently being recorded. I’m not sure on the release date, but it will be fully up-to-date with Swift 3 and include many improvements over this original course.

sam

You guys are awesome! Okay then, no problem. I can try these resources later on.

1 Like