Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

Blocks for UITextField without libffi and swizzling. Getter and Setter properties.

License

Notifications You must be signed in to change notification settings

seivan-archives/SHTextFieldBlocks

Repository files navigation

Deprecated, please use RxCocoa

#SHTextFieldBlocks

CI Status Version Platform License

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;

Contact

If you end up using SHTextFieldBlocks in a project, I'd love to hear about it.

email: [email protected]
twitter: @seivanheidari

License

SHTextFieldBlocks is © 2013 Seivan and may be freely distributed under the MIT license. See the LICENSE.md file.

About

Blocks for UITextField without libffi and swizzling. Getter and Setter properties.

Resources

License

Stars

Watchers

Forks

Packages

No packages published