Latest 0.1.0
Homepage https://github.com/cfeenstra67/cblock
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Example

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.

Requirements

Installation

cblock is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "cblock"

Author

cfeenstra67, [email protected]

License

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": "https://github.com/cfeenstra67/cblock",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "cfeenstra67": "[email protected]"
    },
    "source": {
        "git": "https://github.com/cfeenstra67/cblock.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "cblock/Classes/**/*"
}

Pin It on Pinterest

Share This