What does ^ character in Objective C mean? like in the following code
TWTweetComposeViewControllerCompletionHandler
completionHandler =
^(TWTweetComposeViewControllerResult result) {
switch (result)
{
...
}
[self dismissModalViewControllerAnimated:YES];
};
It denotes a "block", a piece of code that can be packaged into an object and used later. In your example it specifies a completion handler to be called later, presumably when the user clicks "OK" or some similar button to close an alert.
Blocks can also be used with Grand Central Dispatch and in that case they are used to produce a unit of code that can be run on another thread, both synchronously and asynchronously.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With