Deprecated, please use RxCocoa
#SHTextFieldBlocks
This pod is used by
SHUIKitBlocks
as part of many components covering to plug the holes missing from Foundation, UIKit, CoreLocation, GameKit, MapKit and other aspects of an iOS application's architecture.
##Overview
Using blocks instead of delegate callbacks for UITextField. The blocks are gone once the textfield is gone - Swizzle Free(™)
##Installation
pod 'SHTextFieldBlocks'
##Setup
Put this either in specific files or your project prefix file
#import "UITextField+SHTextFieldBlocks.h"
or
#import "SHTextFieldBlocks.h"
##API
#pragma mark - Block Defs
typedef void (^SHTextFieldBlock)(UITextField * textField);
typedef BOOL (^SHTextFieldPredicateBlock)(UITextField * textField);
typedef BOOL (^SHTextFieldRangeReplacementBlock)(UITextField * textField,
NSRange shouldChangeCharactersInRange,
NSString * string);
#pragma mark - Properties
#pragma mark - Setters
-(void)SH_setShouldBeginEditingBlock:(SHTextFieldPredicateBlock)theBlock;
-(void)SH_setDidBeginEditingBlock:(SHTextFieldBlock)theBlock;
-(void)SH_setShouldEndEditingBlock:(SHTextFieldPredicateBlock)theBlock;
-(void)SH_setDidEndEditingBlock:(SHTextFieldBlock)theBlock;
-(void)SH_setShouldChangeCharactersInRangeWithReplacementStringBlock:(SHTextFieldRangeReplacementBlock)theBlock;
-(void)SH_setShouldClearBlock:(SHTextFieldPredicateBlock)theBlock;
-(void)SH_setShouldReturnBlock:(SHTextFieldPredicateBlock)theBlock;
#pragma mark - Getters
-(SHTextFieldPredicateBlock)SH_blockShouldBeginEditing;
-(SHTextFieldBlock)SH_blockDidBeginEditing;
-(SHTextFieldPredicateBlock)SH_blockShouldEndEditing;
-(SHTextFieldBlock)SH_blockDidEndEditing;
-(SHTextFieldRangeReplacementBlock)SH_blockShouldChangeCharactersInRangeWithReplacementString;
-(SHTextFieldPredicateBlock)SH_blockShouldClear;
-(SHTextFieldPredicateBlock)SH_blockShouldReturn;
If you end up using SHTextFieldBlocks in a project, I'd love to hear about it.
email: [email protected]
twitter: @seivanheidari
SHTextFieldBlocks is © 2013 Seivan and may be freely
distributed under the MIT license.
See the LICENSE.md
file.