MikeCastro26
MikeCastro26

Reputation: 93

Declaring a block as typedef

I keep seeing block declarations like this:

typedef returnType (^TypeName)(parameterTypes);

And I would like to know, why would I declare a block as a typedef?

Upvotes: 3

Views: 662

Answers (1)

Nick
Nick

Reputation: 2369

You do it that way to reduce the likelihood of typos and make the code more readable. For an extreme example, see my answer here: Syntax to define a Block that takes a Block and returns a Block in Objective-C

Upvotes: 1

Related Questions