1

I am using block in objective C like

typedef void (^RequestSuccessCallback)(WebRequestManager *request);
@property (nonatomic,copy) RequestSuccessCallback RequestSuccessBlock;

but how to use Block in swift?

1
  • You're asking very basic questions that would only require a cursory look around the web/stackoverflow. There are plenty of good resources on blocks in Swift out there. In future, please show what attempts you have made at solving your problems, especially when they are this basic. Commented May 23, 2015 at 11:04

1 Answer 1

2

Try something like this:

typealias RequestSuccessCallback = (WebRequestManager) -> Void
var requestSuccessBlock: RequestSuccessCallback

Or something like this if you prefer a named callback:

typealias RequestSuccessCallback = (manager: WebRequestManager) -> Void
var requestSuccessBlock: RequestSuccessCallback
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.