CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Apr 2017 |
Maintained by Cam Feenstra.
This pod is extremely simple. It defines a class called 'cblock' with two class methods: 'make' and 'run'. Essentially, these two methods can be used to both define and run a block at the same time. The 'make' call is extremely useful for inline object declarations and allows you to organize your code in a much more logical manner. The 'run' method is slightly less useful, but an example of how it might be used is also given below.
//Example of how [cblock make:] might be used for an inline declaration of back button on a view controller:
[self.navigationItem setLeftBarButtonItem:[cblock make^id{
UIBarButtonItem *newItem=[[UIBarButtonItem alloc] initWithTitle:@"Done" target:self action:@selector(someSelector:)];
[newItem setImageInsets:UIEdgeInsetsZero];
//Other initialization code
return newItem;
}]];
//Example of how [cblock run:] might be used:
some_bool?[cblock run:^{
//Code if some_bool is true
}]:[cblock run^{
//Code if some_bool is false
}];
Basically these two methods help you keep all of your initialization code for each object you create seperate, and also eliminates the need in some cases to define an object or block. I've found this class to be very useful in my development, and I thought other people could benefit as well.
cblock is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "cblock"
cfeenstra67, [email protected]
cblock is available under the MIT license. See the LICENSE file for more info.