Latest 0.1.0
License MIT
Platforms ios 8.0

CI Status


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.

Latest podspec

    "name": "cblock",
    "version": "0.1.0",
    "summary": "A class that leverages blocks to allow for better organization of code in some cases.",
    "description": "This pod defines a class "cblock" with just two class methods--[cblock make:] and [cblock run:].  The make: method allows the programmer to use a block to define a custom object, keeping all of the intialization code together and making the code overall easier to read.  The run: method simply allows the programmer to run a block as soon as it is defined, but offers an inline solution to do so.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "cfeenstra67": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.0"
    "platforms": {
        "ios": "8.0"
    "source_files": "cblock/Classes/**/*"

Pin It on Pinterest

Share This