Anonymous White
Anonymous White

Reputation: 2159

Make a block that accepts a block as argument

void (^block)();
void (^block1)(int);

The first line declare a block.

The second line declare a block that takes an integer argument.

Now I want a block that accepts another block as an argument:

void (^block2)(<another block>);

How would I do so?

Upvotes: 3

Views: 117

Answers (1)

kennytm
kennytm

Reputation: 523294

Use a typedef, e.g.

typedef void (^BlockTypeToAccept)();
void (^block)(BlockTypeToAccept inner_block);

or combine them directly:

void (^block)( void (^inner_block)() );

Upvotes: 8

Related Questions