├── .travis.yml
├── Example
├── UITextField-Blocks Example
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ ├── UITextField-Blocks Example-Prefix.pch
│ ├── main.m
│ ├── Images.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ └── Contents.json
│ │ └── LaunchImage.launchimage
│ │ │ └── Contents.json
│ ├── UITextField-Blocks Example-Info.plist
│ ├── SHCViewController.h
│ ├── SHCAppDelegate.h
│ ├── SHCViewController.m
│ ├── SHCAppDelegate.m
│ └── Base.lproj
│ │ └── Main.storyboard
├── UITextField-Blocks ExampleTests
│ ├── en.lproj
│ │ └── InfoPlist.strings
│ ├── UITextField-Blocks ExampleTests-Info.plist
│ └── UITextField_Blocks_ExampleTests.m
└── UITextField-Blocks Example.xcodeproj
│ ├── project.xcworkspace
│ └── contents.xcworkspacedata
│ ├── xcshareddata
│ └── xcschemes
│ │ └── UITextField-Blocks Example.xcscheme
│ └── project.pbxproj
├── .gitignore
├── UITextField+Blocks.podspec
├── LICENSE
├── UITextField+Blocks.h
├── README.md
└── UITextField+Blocks.m
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: objective-c
2 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks ExampleTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | .DS_Store
3 | */build/*
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | profile
14 | *.moved-aside
15 | DerivedData
16 | .idea/
17 | *.hmap
18 | *.xccheckout
19 |
20 | #CocoaPods
21 | Pods
22 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/UITextField-Blocks Example-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_5_0
10 | #warning "This project uses features only available in iOS SDK 5.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | #import
15 | #import
16 | #endif
17 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // UITextField-Blocks Example
4 | //
5 | // Created by Eivind Bohler on 20.10.13.
6 | // Copyright (c) 2013 Shortcut. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "SHCAppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([SHCAppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
--------------------------------------------------------------------------------
/UITextField+Blocks.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "UITextField+Blocks"
3 | s.version = "1.0.0"
4 | s.summary = "Adds blocks to all UITextField delegate methods with a category, no subclassing. Also allows the use of delegate methods if no block is set."
5 | s.homepage = "https://github.com/haaakon/UITextField-Blocks"
6 | s.author = { "Håkon Bogen" => "hakon.bogen@gmail.com" }
7 | s.license = "MIT"
8 |
9 | s.source = { :git => "https://github.com/haaakon/UITextField-Blocks.git", :tag => "1.0.0" }
10 |
11 | s.platform = :ios, '6.0'
12 | s.source_files = 'UITextField+Blocks.{h,m}'
13 | s.requires_arc = true
14 | end
15 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks ExampleTests/UITextField-Blocks ExampleTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | no.shortcut.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks ExampleTests/UITextField_Blocks_ExampleTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // UITextField_Blocks_ExampleTests.m
3 | // UITextField-Blocks ExampleTests
4 | //
5 | // Created by Eivind Bohler on 20.10.13.
6 | // Copyright (c) 2013 Shortcut. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface UITextField_Blocks_ExampleTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation UITextField_Blocks_ExampleTests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 hakonbogen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/UITextField-Blocks Example-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | no.shortcut.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/SHCViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // SHCViewController.h
3 | // UITextField-Blocks Example
4 | //
5 | // Created by Eivind Bohler on 20.10.13.
6 | // Copyright (c) 2013 Shortcut. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | // SOFTWARE.
25 |
26 | #import
27 |
28 | @interface SHCViewController : UIViewController
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/SHCAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // SHCAppDelegate.h
3 | // UITextField-Blocks Example
4 | //
5 | // Created by Eivind Bohler on 20.10.13.
6 | // Copyright (c) 2013 Shortcut. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | // SOFTWARE.
25 |
26 | #import
27 |
28 | @interface SHCAppDelegate : UIResponder
29 |
30 | @property (strong, nonatomic) UIWindow *window;
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/SHCViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // SHCViewController.m
3 | // UITextField-Blocks Example
4 | //
5 | // Created by Eivind Bohler on 20.10.13.
6 | // Copyright (c) 2013 Shortcut. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | // SOFTWARE.
25 |
26 | #import "SHCViewController.h"
27 | #import "UITextField+Blocks.h"
28 |
29 | @interface SHCViewController ()
30 |
31 | @property (weak, nonatomic) IBOutlet UITextField *textField;
32 |
33 | @end
34 |
35 | @implementation SHCViewController
36 |
37 | #pragma mark - UIViewController
38 |
39 | - (void)viewDidLoad
40 | {
41 | [super viewDidLoad];
42 |
43 | self.textField.didBeginEditingBlock = ^(UITextField *textField){
44 | NSLog(@"%s", __PRETTY_FUNCTION__);
45 | };
46 | [self.textField setDidEndEditingBlock:^(UITextField *textField) {
47 | NSLog(@"%s",__PRETTY_FUNCTION__);
48 | }];
49 |
50 | }
51 |
52 | - (void)didReceiveMemoryWarning
53 | {
54 | [super didReceiveMemoryWarning];
55 | // Dispose of any resources that can be recreated.
56 | }
57 |
58 | #pragma mark - UITextFieldDelegate
59 |
60 | - (void)textFieldDidBeginEditing:(UITextField *)textField
61 | {
62 | NSLog(@"%s", __PRETTY_FUNCTION__);
63 | }
64 |
65 | @end
66 |
--------------------------------------------------------------------------------
/UITextField+Blocks.h:
--------------------------------------------------------------------------------
1 | //
2 | // UITextField+Blocks.h
3 | // UITextFieldBlocks
4 | //
5 | // Created by Håkon Bogen on 19.10.13.
6 | // Copyright (c) 2013 Håkon Bogen. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | // SOFTWARE.
25 |
26 | #import
27 |
28 | @interface UITextField (Blocks)
29 |
30 | @property (copy, nonatomic) BOOL (^shouldBegindEditingBlock)(UITextField *textField);
31 | @property (copy, nonatomic) BOOL (^shouldEndEditingBlock)(UITextField *textField);
32 |
33 | @property (copy, nonatomic) void (^didBeginEditingBlock)(UITextField *textField);
34 | @property (copy, nonatomic) void (^didEndEditingBlock)(UITextField *textField);
35 |
36 | @property (copy, nonatomic) BOOL (^shouldChangeCharactersInRangeBlock)(UITextField *textField, NSRange range, NSString *replacementString);
37 |
38 | @property (copy, nonatomic) BOOL (^shouldReturnBlock)(UITextField *textField);
39 | @property (copy, nonatomic) BOOL (^shouldClearBlock)(UITextField *textField);
40 |
41 | - (void)setShouldBegindEditingBlock:(BOOL (^)(UITextField *textField))shouldBegindEditingBlock;
42 | - (void)setShouldEndEditingBlock:(BOOL (^)(UITextField *textField))shouldEndEditingBlock;
43 |
44 | - (void)setDidBeginEditingBlock:(void (^)(UITextField *textField))didBeginEditingBlock;
45 | - (void)setDidEndEditingBlock:(void (^)(UITextField *textField))didEndEditingBlock;
46 |
47 | - (void)setShouldChangeCharactersInRangeBlock:(BOOL (^)(UITextField *textField, NSRange range, NSString *string))shouldChangeCharactersInRangeBlock;
48 |
49 | - (void)setShouldClearBlock:(BOOL (^)(UITextField *textField))shouldClearBlock;
50 | - (void)setShouldReturnBlock:(BOOL (^)(UITextField *textField))shouldReturnBlock;
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/SHCAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // SHCAppDelegate.m
3 | // UITextField-Blocks Example
4 | //
5 | // Created by Eivind Bohler on 20.10.13.
6 | // Copyright (c) 2013 Shortcut. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | // SOFTWARE.
25 |
26 | #import "SHCAppDelegate.h"
27 |
28 | @implementation SHCAppDelegate
29 |
30 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
31 | {
32 | // Override point for customization after application launch.
33 | return YES;
34 | }
35 |
36 | - (void)applicationWillResignActive:(UIApplication *)application
37 | {
38 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
39 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
40 | }
41 |
42 | - (void)applicationDidEnterBackground:(UIApplication *)application
43 | {
44 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
45 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
46 | }
47 |
48 | - (void)applicationWillEnterForeground:(UIApplication *)application
49 | {
50 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
51 | }
52 |
53 | - (void)applicationDidBecomeActive:(UIApplication *)application
54 | {
55 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
56 | }
57 |
58 | - (void)applicationWillTerminate:(UIApplication *)application
59 | {
60 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
61 | }
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | UITextField-Blocks
2 | ==================
3 |
4 | Adds blocks to all UITextField delegate methods with a category, no subclassing. Also allows the use of delegate methods if no block is set.
5 |
6 | Installation
7 | ============
8 | Simply use [CocoaPods](http://cocoapods.org/):
9 |
10 | `pod 'UITextField+Blocks'`
11 |
12 | USAGE
13 | =====
14 |
15 | #### TextFieldShouldBeginEditing
16 | ```objective-c
17 |
18 | #import
19 | UITextField *aTextField;
20 | [aTextField setShouldBegindEditingBlock:^BOOL(UITextField *textField) {
21 | // do your stuff here
22 | return YES;
23 | }];
24 |
25 | ```
26 |
27 | #### textFieldDidBeginEditing
28 |
29 | ```objective-c
30 | [aTextField setDidBeginEditingBlock:^(UITextField *textField) {
31 | // do your stuff here
32 | }];
33 |
34 | ```
35 |
36 | #### textFieldShouldEndEditing
37 |
38 | ```objective-c
39 | [aTextField setShouldEndEditingBlock:^BOOL(UITextField *textField) {
40 | // do your stuff here
41 | return YES;
42 | }];
43 |
44 | ```
45 |
46 | #### textFieldDidEndEditing
47 |
48 | ```objective-c
49 | [aTextField setDidEndEditingBlock:^BOOL(UITextField *textField) {
50 | // do your stuff here
51 | }];
52 |
53 | ```
54 |
55 | #### textField:shouldChangeCharactersInRange:replacementString:
56 |
57 | ```objective-c
58 | [aTextField setShouldChangeCharactersInRangeBlock:^BOOL(UITextField *textField, NSRange range, NSString *replacementString) {
59 | // do your stuff here
60 | return YES;
61 | }];
62 | ```
63 | #### textFieldShouldClear
64 |
65 | ```objective-c
66 | [aTextField setShouldClearBlock:^BOOL(UITextField *textField) {
67 | // do your stuff here
68 | return NO;
69 | }];
70 | ```
71 | #### textFieldShouldReturn
72 | ```objective-c
73 | [aTextField setShouldReturnBlock:^BOOL(UITextField *textField) {
74 | // do your stuff here
75 | return NO;
76 | }];
77 | ```
78 |
79 | Remember, you can also use ordinary delegate methods for all methods you don't define as blocks.
80 |
81 | In this example, shouldBeginEditing is defined as a block, and didEndEditing is a delegate method
82 |
83 | ```objective-c
84 |
85 | aTextField.delegate = self;
86 |
87 | [aTextField setShouldBegindEditingBlock:^BOOL(UITextField *textField) {
88 | // do your stuff here
89 | return YES;
90 | }];
91 |
92 | - (void)textFieldDidEndEditing:(UITextField *)textField
93 | {
94 | // do your stuff here
95 | }
96 | ```
97 |
98 | ### LICENSE
99 |
100 | Copyright (C) 2013 Developed by Håkon Bogen
101 |
102 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
103 |
104 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
105 |
106 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
107 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example.xcodeproj/xcshareddata/xcschemes/UITextField-Blocks Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/UITextField+Blocks.m:
--------------------------------------------------------------------------------
1 | //
2 | // UITextField+Blocks.m
3 | // UITextFieldBlocks
4 | //
5 | // Created by Håkon Bogen on 19.10.13.
6 | // Copyright (c) 2013 Håkon Bogen. All rights reserved.
7 | //
8 | // Permission is hereby granted, free of charge, to any person obtaining a copy
9 | // of this software and associated documentation files (the "Software"), to deal
10 | // in the Software without restriction, including without limitation the rights
11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 | // copies of the Software, and to permit persons to whom the Software is
13 | // furnished to do so, subject to the following conditions:
14 | //
15 | // The above copyright notice and this permission notice shall be included in
16 | // all copies or substantial portions of the Software.
17 | //
18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 | // SOFTWARE.
25 |
26 | #import "UITextField+Blocks.h"
27 | #import
28 |
29 | typedef BOOL (^UITextFieldReturnBlock) (UITextField *textField);
30 | typedef void (^UITextFieldVoidBlock) (UITextField *textField);
31 | typedef BOOL (^UITextFieldCharacterChangeBlock) (UITextField *textField, NSRange range, NSString *replacementString);
32 |
33 | @implementation UITextField (Blocks)
34 |
35 | static const void *UITextFieldDelegateKey = &UITextFieldDelegateKey;
36 |
37 | static const void *UITextFieldShouldBeginEditingKey = &UITextFieldShouldBeginEditingKey;
38 | static const void *UITextFieldShouldEndEditingKey = &UITextFieldShouldEndEditingKey;
39 |
40 | static const void *UITextFieldDidBeginEditingKey = &UITextFieldDidBeginEditingKey;
41 | static const void *UITextFieldDidEndEditingKey = &UITextFieldDidEndEditingKey;
42 |
43 | static const void *UITextFieldShouldChangeCharactersInRangeKey = &UITextFieldShouldChangeCharactersInRangeKey;
44 |
45 | static const void *UITextFieldShouldClearKey = &UITextFieldShouldClearKey;
46 | static const void *UITextFieldShouldReturnKey = &UITextFieldShouldReturnKey;
47 |
48 | #pragma mark UITextField Delegate methods
49 |
50 | + (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
51 | {
52 | UITextFieldReturnBlock block = textField.shouldBegindEditingBlock;
53 | if (block) {
54 | return block(textField);
55 | }
56 |
57 | id delegate = objc_getAssociatedObject(self, UITextFieldDelegateKey);
58 |
59 | if ([delegate respondsToSelector:@selector(textFieldShouldBeginEditing:)]) {
60 | return [delegate textFieldShouldBeginEditing:textField];
61 | }
62 | // return default value just in case
63 | return YES;
64 | }
65 |
66 | + (BOOL)textFieldShouldEndEditing:(UITextField *)textField
67 | {
68 | UITextFieldReturnBlock block = textField.shouldEndEditingBlock;
69 | if (block) {
70 | return block(textField);
71 | }
72 |
73 | id delegate = objc_getAssociatedObject(self, UITextFieldDelegateKey);
74 |
75 | if ([delegate respondsToSelector:@selector(textFieldShouldEndEditing:)]) {
76 | return [delegate textFieldShouldEndEditing:textField];
77 | }
78 | // return default value just in case
79 | return YES;
80 | }
81 |
82 | + (void)textFieldDidBeginEditing:(UITextField *)textField
83 | {
84 | UITextFieldVoidBlock block = textField.didBeginEditingBlock;
85 | if (block) {
86 | block(textField);
87 | }
88 |
89 | id delegate = objc_getAssociatedObject(self, UITextFieldDelegateKey);
90 |
91 | if ([delegate respondsToSelector:@selector(textFieldDidBeginEditing:)]) {
92 | [delegate textFieldDidBeginEditing:textField];
93 | }
94 | }
95 |
96 | + (void)textFieldDidEndEditing:(UITextField *)textField
97 | {
98 | UITextFieldVoidBlock block = textField.didEndEditingBlock;
99 | if (block) {
100 | block(textField);
101 | }
102 |
103 | id delegate = objc_getAssociatedObject(self, UITextFieldDelegateKey);
104 |
105 | if ([delegate respondsToSelector:@selector(textFieldDidEndEditing:)]) {
106 | [delegate textFieldDidEndEditing:textField];
107 | }
108 | }
109 |
110 | + (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
111 | {
112 | UITextFieldCharacterChangeBlock block = textField.shouldChangeCharactersInRangeBlock;
113 | if (block) {
114 | return block(textField,range,string);
115 | }
116 |
117 | id delegate = objc_getAssociatedObject(self, UITextFieldDelegateKey);
118 |
119 | if ([delegate respondsToSelector:@selector(textField:shouldChangeCharactersInRange:replacementString:)]) {
120 | return [delegate textField:textField shouldChangeCharactersInRange:range replacementString:string];
121 | }
122 | return YES;
123 | }
124 |
125 | + (BOOL)textFieldShouldClear:(UITextField *)textField
126 | {
127 | UITextFieldReturnBlock block = textField.shouldClearBlock;
128 | if (block) {
129 | return block(textField);
130 | }
131 |
132 | id delegate = objc_getAssociatedObject(self, UITextFieldDelegateKey);
133 |
134 | if ([delegate respondsToSelector:@selector(textFieldShouldClear:)]) {
135 | return [delegate textFieldShouldClear:textField];
136 | }
137 | return YES;
138 | }
139 |
140 | + (BOOL)textFieldShouldReturn:(UITextField *)textField
141 | {
142 | UITextFieldReturnBlock block = textField.shouldReturnBlock;
143 | if (block) {
144 | return block(textField);
145 | }
146 |
147 | id delegate = objc_getAssociatedObject(self, UITextFieldDelegateKey);
148 |
149 | if ([delegate respondsToSelector:@selector(textFieldShouldReturn:)]) {
150 | return [delegate textFieldShouldReturn:textField];
151 | }
152 | return YES;
153 | }
154 |
155 | #pragma mark Block setting/getting methods
156 |
157 | - (BOOL (^)(UITextField *))shouldBegindEditingBlock
158 | {
159 | return objc_getAssociatedObject(self, UITextFieldShouldBeginEditingKey);
160 | }
161 |
162 | - (void)setShouldBegindEditingBlock:(BOOL (^)(UITextField *))shouldBegindEditingBlock
163 | {
164 | [self setDelegateIfNoDelegateSet];
165 | objc_setAssociatedObject(self, UITextFieldShouldBeginEditingKey, shouldBegindEditingBlock, OBJC_ASSOCIATION_COPY);
166 | }
167 |
168 | - (BOOL (^)(UITextField *))shouldEndEditingBlock
169 | {
170 | return objc_getAssociatedObject(self, UITextFieldShouldEndEditingKey);
171 | }
172 |
173 | - (void)setShouldEndEditingBlock:(BOOL (^)(UITextField *))shouldEndEditingBlock
174 | {
175 | [self setDelegateIfNoDelegateSet];
176 | objc_setAssociatedObject(self, UITextFieldShouldEndEditingKey, shouldEndEditingBlock, OBJC_ASSOCIATION_COPY);
177 | }
178 |
179 | - (void (^)(UITextField *))didBeginEditingBlock
180 | {
181 | return objc_getAssociatedObject(self, UITextFieldDidBeginEditingKey);
182 |
183 | }
184 |
185 | - (void)setDidBeginEditingBlock:(void (^)(UITextField *))didBeginEditingBlock
186 | {
187 | [self setDelegateIfNoDelegateSet];
188 | objc_setAssociatedObject(self, UITextFieldDidBeginEditingKey, didBeginEditingBlock, OBJC_ASSOCIATION_COPY);
189 | }
190 |
191 | - (void (^)(UITextField *))didEndEditingBlock
192 | {
193 | return objc_getAssociatedObject(self, UITextFieldDidEndEditingKey);
194 | }
195 |
196 | - (void)setDidEndEditingBlock:(void (^)(UITextField *))didEndEditingBlock
197 | {
198 | [self setDelegateIfNoDelegateSet];
199 | objc_setAssociatedObject(self, UITextFieldDidEndEditingKey, didEndEditingBlock, OBJC_ASSOCIATION_COPY);
200 | }
201 |
202 | - (BOOL (^)(UITextField *, NSRange, NSString *))shouldChangeCharactersInRangeBlock
203 | {
204 | return objc_getAssociatedObject(self, UITextFieldShouldChangeCharactersInRangeKey);
205 | }
206 |
207 | - (void)setShouldChangeCharactersInRangeBlock:(BOOL (^)(UITextField *, NSRange, NSString *))shouldChangeCharactersInRangeBlock
208 | {
209 | [self setDelegateIfNoDelegateSet];
210 | objc_setAssociatedObject(self, UITextFieldShouldChangeCharactersInRangeKey, shouldChangeCharactersInRangeBlock, OBJC_ASSOCIATION_COPY);
211 | }
212 |
213 | - (BOOL (^)(UITextField *))shouldReturnBlock
214 | {
215 | return objc_getAssociatedObject(self, UITextFieldShouldReturnKey);
216 | }
217 |
218 | - (void)setShouldReturnBlock:(BOOL (^)(UITextField *))shouldReturnBlock
219 | {
220 | [self setDelegateIfNoDelegateSet];
221 | objc_setAssociatedObject(self, UITextFieldShouldReturnKey, shouldReturnBlock, OBJC_ASSOCIATION_COPY);
222 | }
223 |
224 | - (BOOL (^)(UITextField *))shouldClearBlock
225 | {
226 | return objc_getAssociatedObject(self, UITextFieldShouldClearKey);
227 | }
228 |
229 | - (void)setShouldClearBlock:(BOOL (^)(UITextField *textField))shouldClearBlock
230 | {
231 | [self setDelegateIfNoDelegateSet];
232 | objc_setAssociatedObject(self, UITextFieldShouldClearKey, shouldClearBlock, OBJC_ASSOCIATION_COPY);
233 | }
234 |
235 | #pragma mark control method
236 | /*
237 | Setting itself as delegate if no other delegate has been set. This ensures the UITextField will use blocks if no delegate is set.
238 | */
239 | - (void)setDelegateIfNoDelegateSet
240 | {
241 | if (self.delegate != (id)[self class]) {
242 | objc_setAssociatedObject(self, UITextFieldDelegateKey, self.delegate, OBJC_ASSOCIATION_ASSIGN);
243 | self.delegate = (id)[self class];
244 | }
245 | }
246 |
247 | @end
248 |
--------------------------------------------------------------------------------
/Example/UITextField-Blocks Example.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 83FB8C101813EF7000DEA8EB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83FB8C0F1813EF7000DEA8EB /* Foundation.framework */; };
11 | 83FB8C121813EF7000DEA8EB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83FB8C111813EF7000DEA8EB /* CoreGraphics.framework */; };
12 | 83FB8C141813EF7000DEA8EB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83FB8C131813EF7000DEA8EB /* UIKit.framework */; };
13 | 83FB8C1A1813EF7000DEA8EB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 83FB8C181813EF7000DEA8EB /* InfoPlist.strings */; };
14 | 83FB8C1C1813EF7000DEA8EB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 83FB8C1B1813EF7000DEA8EB /* main.m */; };
15 | 83FB8C201813EF7000DEA8EB /* SHCAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 83FB8C1F1813EF7000DEA8EB /* SHCAppDelegate.m */; };
16 | 83FB8C231813EF7000DEA8EB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 83FB8C211813EF7000DEA8EB /* Main.storyboard */; };
17 | 83FB8C261813EF7000DEA8EB /* SHCViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 83FB8C251813EF7000DEA8EB /* SHCViewController.m */; };
18 | 83FB8C281813EF7000DEA8EB /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 83FB8C271813EF7000DEA8EB /* Images.xcassets */; };
19 | 83FB8C2F1813EF7000DEA8EB /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83FB8C2E1813EF7000DEA8EB /* XCTest.framework */; };
20 | 83FB8C301813EF7000DEA8EB /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83FB8C0F1813EF7000DEA8EB /* Foundation.framework */; };
21 | 83FB8C311813EF7000DEA8EB /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83FB8C131813EF7000DEA8EB /* UIKit.framework */; };
22 | 83FB8C391813EF7000DEA8EB /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 83FB8C371813EF7000DEA8EB /* InfoPlist.strings */; };
23 | 83FB8C3B1813EF7000DEA8EB /* UITextField_Blocks_ExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 83FB8C3A1813EF7000DEA8EB /* UITextField_Blocks_ExampleTests.m */; };
24 | 83FB8C471813EF8500DEA8EB /* UITextField+Blocks.m in Sources */ = {isa = PBXBuildFile; fileRef = 83FB8C461813EF8500DEA8EB /* UITextField+Blocks.m */; };
25 | /* End PBXBuildFile section */
26 |
27 | /* Begin PBXContainerItemProxy section */
28 | 83FB8C321813EF7000DEA8EB /* PBXContainerItemProxy */ = {
29 | isa = PBXContainerItemProxy;
30 | containerPortal = 83FB8C041813EF7000DEA8EB /* Project object */;
31 | proxyType = 1;
32 | remoteGlobalIDString = 83FB8C0B1813EF7000DEA8EB;
33 | remoteInfo = "UITextField-Blocks Example";
34 | };
35 | /* End PBXContainerItemProxy section */
36 |
37 | /* Begin PBXFileReference section */
38 | 83FB8C0C1813EF7000DEA8EB /* UITextField-Blocks Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "UITextField-Blocks Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
39 | 83FB8C0F1813EF7000DEA8EB /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
40 | 83FB8C111813EF7000DEA8EB /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
41 | 83FB8C131813EF7000DEA8EB /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
42 | 83FB8C171813EF7000DEA8EB /* UITextField-Blocks Example-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UITextField-Blocks Example-Info.plist"; sourceTree = ""; };
43 | 83FB8C191813EF7000DEA8EB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
44 | 83FB8C1B1813EF7000DEA8EB /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
45 | 83FB8C1D1813EF7000DEA8EB /* UITextField-Blocks Example-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UITextField-Blocks Example-Prefix.pch"; sourceTree = ""; };
46 | 83FB8C1E1813EF7000DEA8EB /* SHCAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SHCAppDelegate.h; sourceTree = ""; };
47 | 83FB8C1F1813EF7000DEA8EB /* SHCAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SHCAppDelegate.m; sourceTree = ""; };
48 | 83FB8C221813EF7000DEA8EB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
49 | 83FB8C241813EF7000DEA8EB /* SHCViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SHCViewController.h; sourceTree = ""; };
50 | 83FB8C251813EF7000DEA8EB /* SHCViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SHCViewController.m; sourceTree = ""; };
51 | 83FB8C271813EF7000DEA8EB /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
52 | 83FB8C2D1813EF7000DEA8EB /* UITextField-Blocks ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UITextField-Blocks ExampleTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
53 | 83FB8C2E1813EF7000DEA8EB /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
54 | 83FB8C361813EF7000DEA8EB /* UITextField-Blocks ExampleTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "UITextField-Blocks ExampleTests-Info.plist"; sourceTree = ""; };
55 | 83FB8C381813EF7000DEA8EB /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
56 | 83FB8C3A1813EF7000DEA8EB /* UITextField_Blocks_ExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UITextField_Blocks_ExampleTests.m; sourceTree = ""; };
57 | 83FB8C451813EF8500DEA8EB /* UITextField+Blocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UITextField+Blocks.h"; path = "../UITextField+Blocks.h"; sourceTree = ""; };
58 | 83FB8C461813EF8500DEA8EB /* UITextField+Blocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UITextField+Blocks.m"; path = "../UITextField+Blocks.m"; sourceTree = ""; };
59 | /* End PBXFileReference section */
60 |
61 | /* Begin PBXFrameworksBuildPhase section */
62 | 83FB8C091813EF7000DEA8EB /* Frameworks */ = {
63 | isa = PBXFrameworksBuildPhase;
64 | buildActionMask = 2147483647;
65 | files = (
66 | 83FB8C121813EF7000DEA8EB /* CoreGraphics.framework in Frameworks */,
67 | 83FB8C141813EF7000DEA8EB /* UIKit.framework in Frameworks */,
68 | 83FB8C101813EF7000DEA8EB /* Foundation.framework in Frameworks */,
69 | );
70 | runOnlyForDeploymentPostprocessing = 0;
71 | };
72 | 83FB8C2A1813EF7000DEA8EB /* Frameworks */ = {
73 | isa = PBXFrameworksBuildPhase;
74 | buildActionMask = 2147483647;
75 | files = (
76 | 83FB8C2F1813EF7000DEA8EB /* XCTest.framework in Frameworks */,
77 | 83FB8C311813EF7000DEA8EB /* UIKit.framework in Frameworks */,
78 | 83FB8C301813EF7000DEA8EB /* Foundation.framework in Frameworks */,
79 | );
80 | runOnlyForDeploymentPostprocessing = 0;
81 | };
82 | /* End PBXFrameworksBuildPhase section */
83 |
84 | /* Begin PBXGroup section */
85 | 83FB8C031813EF7000DEA8EB = {
86 | isa = PBXGroup;
87 | children = (
88 | 83FB8C441813EF7A00DEA8EB /* UITextField-Blocks */,
89 | 83FB8C151813EF7000DEA8EB /* UITextField-Blocks Example */,
90 | 83FB8C341813EF7000DEA8EB /* UITextField-Blocks ExampleTests */,
91 | 83FB8C0E1813EF7000DEA8EB /* Frameworks */,
92 | 83FB8C0D1813EF7000DEA8EB /* Products */,
93 | );
94 | sourceTree = "";
95 | };
96 | 83FB8C0D1813EF7000DEA8EB /* Products */ = {
97 | isa = PBXGroup;
98 | children = (
99 | 83FB8C0C1813EF7000DEA8EB /* UITextField-Blocks Example.app */,
100 | 83FB8C2D1813EF7000DEA8EB /* UITextField-Blocks ExampleTests.xctest */,
101 | );
102 | name = Products;
103 | sourceTree = "";
104 | };
105 | 83FB8C0E1813EF7000DEA8EB /* Frameworks */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 83FB8C0F1813EF7000DEA8EB /* Foundation.framework */,
109 | 83FB8C111813EF7000DEA8EB /* CoreGraphics.framework */,
110 | 83FB8C131813EF7000DEA8EB /* UIKit.framework */,
111 | 83FB8C2E1813EF7000DEA8EB /* XCTest.framework */,
112 | );
113 | name = Frameworks;
114 | sourceTree = "";
115 | };
116 | 83FB8C151813EF7000DEA8EB /* UITextField-Blocks Example */ = {
117 | isa = PBXGroup;
118 | children = (
119 | 83FB8C1E1813EF7000DEA8EB /* SHCAppDelegate.h */,
120 | 83FB8C1F1813EF7000DEA8EB /* SHCAppDelegate.m */,
121 | 83FB8C211813EF7000DEA8EB /* Main.storyboard */,
122 | 83FB8C241813EF7000DEA8EB /* SHCViewController.h */,
123 | 83FB8C251813EF7000DEA8EB /* SHCViewController.m */,
124 | 83FB8C271813EF7000DEA8EB /* Images.xcassets */,
125 | 83FB8C161813EF7000DEA8EB /* Supporting Files */,
126 | );
127 | path = "UITextField-Blocks Example";
128 | sourceTree = "";
129 | };
130 | 83FB8C161813EF7000DEA8EB /* Supporting Files */ = {
131 | isa = PBXGroup;
132 | children = (
133 | 83FB8C171813EF7000DEA8EB /* UITextField-Blocks Example-Info.plist */,
134 | 83FB8C181813EF7000DEA8EB /* InfoPlist.strings */,
135 | 83FB8C1B1813EF7000DEA8EB /* main.m */,
136 | 83FB8C1D1813EF7000DEA8EB /* UITextField-Blocks Example-Prefix.pch */,
137 | );
138 | name = "Supporting Files";
139 | sourceTree = "";
140 | };
141 | 83FB8C341813EF7000DEA8EB /* UITextField-Blocks ExampleTests */ = {
142 | isa = PBXGroup;
143 | children = (
144 | 83FB8C3A1813EF7000DEA8EB /* UITextField_Blocks_ExampleTests.m */,
145 | 83FB8C351813EF7000DEA8EB /* Supporting Files */,
146 | );
147 | path = "UITextField-Blocks ExampleTests";
148 | sourceTree = "";
149 | };
150 | 83FB8C351813EF7000DEA8EB /* Supporting Files */ = {
151 | isa = PBXGroup;
152 | children = (
153 | 83FB8C361813EF7000DEA8EB /* UITextField-Blocks ExampleTests-Info.plist */,
154 | 83FB8C371813EF7000DEA8EB /* InfoPlist.strings */,
155 | );
156 | name = "Supporting Files";
157 | sourceTree = "";
158 | };
159 | 83FB8C441813EF7A00DEA8EB /* UITextField-Blocks */ = {
160 | isa = PBXGroup;
161 | children = (
162 | 83FB8C451813EF8500DEA8EB /* UITextField+Blocks.h */,
163 | 83FB8C461813EF8500DEA8EB /* UITextField+Blocks.m */,
164 | );
165 | name = "UITextField-Blocks";
166 | sourceTree = "";
167 | };
168 | /* End PBXGroup section */
169 |
170 | /* Begin PBXNativeTarget section */
171 | 83FB8C0B1813EF7000DEA8EB /* UITextField-Blocks Example */ = {
172 | isa = PBXNativeTarget;
173 | buildConfigurationList = 83FB8C3E1813EF7000DEA8EB /* Build configuration list for PBXNativeTarget "UITextField-Blocks Example" */;
174 | buildPhases = (
175 | 83FB8C081813EF7000DEA8EB /* Sources */,
176 | 83FB8C091813EF7000DEA8EB /* Frameworks */,
177 | 83FB8C0A1813EF7000DEA8EB /* Resources */,
178 | );
179 | buildRules = (
180 | );
181 | dependencies = (
182 | );
183 | name = "UITextField-Blocks Example";
184 | productName = "UITextField-Blocks Example";
185 | productReference = 83FB8C0C1813EF7000DEA8EB /* UITextField-Blocks Example.app */;
186 | productType = "com.apple.product-type.application";
187 | };
188 | 83FB8C2C1813EF7000DEA8EB /* UITextField-Blocks ExampleTests */ = {
189 | isa = PBXNativeTarget;
190 | buildConfigurationList = 83FB8C411813EF7000DEA8EB /* Build configuration list for PBXNativeTarget "UITextField-Blocks ExampleTests" */;
191 | buildPhases = (
192 | 83FB8C291813EF7000DEA8EB /* Sources */,
193 | 83FB8C2A1813EF7000DEA8EB /* Frameworks */,
194 | 83FB8C2B1813EF7000DEA8EB /* Resources */,
195 | );
196 | buildRules = (
197 | );
198 | dependencies = (
199 | 83FB8C331813EF7000DEA8EB /* PBXTargetDependency */,
200 | );
201 | name = "UITextField-Blocks ExampleTests";
202 | productName = "UITextField-Blocks ExampleTests";
203 | productReference = 83FB8C2D1813EF7000DEA8EB /* UITextField-Blocks ExampleTests.xctest */;
204 | productType = "com.apple.product-type.bundle.unit-test";
205 | };
206 | /* End PBXNativeTarget section */
207 |
208 | /* Begin PBXProject section */
209 | 83FB8C041813EF7000DEA8EB /* Project object */ = {
210 | isa = PBXProject;
211 | attributes = {
212 | CLASSPREFIX = SHC;
213 | LastUpgradeCheck = 0500;
214 | ORGANIZATIONNAME = Shortcut;
215 | TargetAttributes = {
216 | 83FB8C2C1813EF7000DEA8EB = {
217 | TestTargetID = 83FB8C0B1813EF7000DEA8EB;
218 | };
219 | };
220 | };
221 | buildConfigurationList = 83FB8C071813EF7000DEA8EB /* Build configuration list for PBXProject "UITextField-Blocks Example" */;
222 | compatibilityVersion = "Xcode 3.2";
223 | developmentRegion = English;
224 | hasScannedForEncodings = 0;
225 | knownRegions = (
226 | en,
227 | Base,
228 | );
229 | mainGroup = 83FB8C031813EF7000DEA8EB;
230 | productRefGroup = 83FB8C0D1813EF7000DEA8EB /* Products */;
231 | projectDirPath = "";
232 | projectRoot = "";
233 | targets = (
234 | 83FB8C0B1813EF7000DEA8EB /* UITextField-Blocks Example */,
235 | 83FB8C2C1813EF7000DEA8EB /* UITextField-Blocks ExampleTests */,
236 | );
237 | };
238 | /* End PBXProject section */
239 |
240 | /* Begin PBXResourcesBuildPhase section */
241 | 83FB8C0A1813EF7000DEA8EB /* Resources */ = {
242 | isa = PBXResourcesBuildPhase;
243 | buildActionMask = 2147483647;
244 | files = (
245 | 83FB8C281813EF7000DEA8EB /* Images.xcassets in Resources */,
246 | 83FB8C1A1813EF7000DEA8EB /* InfoPlist.strings in Resources */,
247 | 83FB8C231813EF7000DEA8EB /* Main.storyboard in Resources */,
248 | );
249 | runOnlyForDeploymentPostprocessing = 0;
250 | };
251 | 83FB8C2B1813EF7000DEA8EB /* Resources */ = {
252 | isa = PBXResourcesBuildPhase;
253 | buildActionMask = 2147483647;
254 | files = (
255 | 83FB8C391813EF7000DEA8EB /* InfoPlist.strings in Resources */,
256 | );
257 | runOnlyForDeploymentPostprocessing = 0;
258 | };
259 | /* End PBXResourcesBuildPhase section */
260 |
261 | /* Begin PBXSourcesBuildPhase section */
262 | 83FB8C081813EF7000DEA8EB /* Sources */ = {
263 | isa = PBXSourcesBuildPhase;
264 | buildActionMask = 2147483647;
265 | files = (
266 | 83FB8C1C1813EF7000DEA8EB /* main.m in Sources */,
267 | 83FB8C261813EF7000DEA8EB /* SHCViewController.m in Sources */,
268 | 83FB8C201813EF7000DEA8EB /* SHCAppDelegate.m in Sources */,
269 | 83FB8C471813EF8500DEA8EB /* UITextField+Blocks.m in Sources */,
270 | );
271 | runOnlyForDeploymentPostprocessing = 0;
272 | };
273 | 83FB8C291813EF7000DEA8EB /* Sources */ = {
274 | isa = PBXSourcesBuildPhase;
275 | buildActionMask = 2147483647;
276 | files = (
277 | 83FB8C3B1813EF7000DEA8EB /* UITextField_Blocks_ExampleTests.m in Sources */,
278 | );
279 | runOnlyForDeploymentPostprocessing = 0;
280 | };
281 | /* End PBXSourcesBuildPhase section */
282 |
283 | /* Begin PBXTargetDependency section */
284 | 83FB8C331813EF7000DEA8EB /* PBXTargetDependency */ = {
285 | isa = PBXTargetDependency;
286 | target = 83FB8C0B1813EF7000DEA8EB /* UITextField-Blocks Example */;
287 | targetProxy = 83FB8C321813EF7000DEA8EB /* PBXContainerItemProxy */;
288 | };
289 | /* End PBXTargetDependency section */
290 |
291 | /* Begin PBXVariantGroup section */
292 | 83FB8C181813EF7000DEA8EB /* InfoPlist.strings */ = {
293 | isa = PBXVariantGroup;
294 | children = (
295 | 83FB8C191813EF7000DEA8EB /* en */,
296 | );
297 | name = InfoPlist.strings;
298 | sourceTree = "";
299 | };
300 | 83FB8C211813EF7000DEA8EB /* Main.storyboard */ = {
301 | isa = PBXVariantGroup;
302 | children = (
303 | 83FB8C221813EF7000DEA8EB /* Base */,
304 | );
305 | name = Main.storyboard;
306 | sourceTree = "";
307 | };
308 | 83FB8C371813EF7000DEA8EB /* InfoPlist.strings */ = {
309 | isa = PBXVariantGroup;
310 | children = (
311 | 83FB8C381813EF7000DEA8EB /* en */,
312 | );
313 | name = InfoPlist.strings;
314 | sourceTree = "";
315 | };
316 | /* End PBXVariantGroup section */
317 |
318 | /* Begin XCBuildConfiguration section */
319 | 83FB8C3C1813EF7000DEA8EB /* Debug */ = {
320 | isa = XCBuildConfiguration;
321 | buildSettings = {
322 | ALWAYS_SEARCH_USER_PATHS = NO;
323 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
325 | CLANG_CXX_LIBRARY = "libc++";
326 | CLANG_ENABLE_MODULES = YES;
327 | CLANG_ENABLE_OBJC_ARC = YES;
328 | CLANG_WARN_BOOL_CONVERSION = YES;
329 | CLANG_WARN_CONSTANT_CONVERSION = YES;
330 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
331 | CLANG_WARN_EMPTY_BODY = YES;
332 | CLANG_WARN_ENUM_CONVERSION = YES;
333 | CLANG_WARN_INT_CONVERSION = YES;
334 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
335 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
336 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
337 | COPY_PHASE_STRIP = NO;
338 | GCC_C_LANGUAGE_STANDARD = gnu99;
339 | GCC_DYNAMIC_NO_PIC = NO;
340 | GCC_OPTIMIZATION_LEVEL = 0;
341 | GCC_PREPROCESSOR_DEFINITIONS = (
342 | "DEBUG=1",
343 | "$(inherited)",
344 | );
345 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
348 | GCC_WARN_UNDECLARED_SELECTOR = YES;
349 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
350 | GCC_WARN_UNUSED_FUNCTION = YES;
351 | GCC_WARN_UNUSED_VARIABLE = YES;
352 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
353 | ONLY_ACTIVE_ARCH = YES;
354 | SDKROOT = iphoneos;
355 | };
356 | name = Debug;
357 | };
358 | 83FB8C3D1813EF7000DEA8EB /* Release */ = {
359 | isa = XCBuildConfiguration;
360 | buildSettings = {
361 | ALWAYS_SEARCH_USER_PATHS = NO;
362 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
363 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
364 | CLANG_CXX_LIBRARY = "libc++";
365 | CLANG_ENABLE_MODULES = YES;
366 | CLANG_ENABLE_OBJC_ARC = YES;
367 | CLANG_WARN_BOOL_CONVERSION = YES;
368 | CLANG_WARN_CONSTANT_CONVERSION = YES;
369 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
370 | CLANG_WARN_EMPTY_BODY = YES;
371 | CLANG_WARN_ENUM_CONVERSION = YES;
372 | CLANG_WARN_INT_CONVERSION = YES;
373 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
374 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
375 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
376 | COPY_PHASE_STRIP = YES;
377 | ENABLE_NS_ASSERTIONS = NO;
378 | GCC_C_LANGUAGE_STANDARD = gnu99;
379 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
380 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
381 | GCC_WARN_UNDECLARED_SELECTOR = YES;
382 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
383 | GCC_WARN_UNUSED_FUNCTION = YES;
384 | GCC_WARN_UNUSED_VARIABLE = YES;
385 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
386 | SDKROOT = iphoneos;
387 | VALIDATE_PRODUCT = YES;
388 | };
389 | name = Release;
390 | };
391 | 83FB8C3F1813EF7000DEA8EB /* Debug */ = {
392 | isa = XCBuildConfiguration;
393 | buildSettings = {
394 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
395 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
396 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
397 | GCC_PREFIX_HEADER = "UITextField-Blocks Example/UITextField-Blocks Example-Prefix.pch";
398 | INFOPLIST_FILE = "UITextField-Blocks Example/UITextField-Blocks Example-Info.plist";
399 | PRODUCT_NAME = "$(TARGET_NAME)";
400 | WRAPPER_EXTENSION = app;
401 | };
402 | name = Debug;
403 | };
404 | 83FB8C401813EF7000DEA8EB /* Release */ = {
405 | isa = XCBuildConfiguration;
406 | buildSettings = {
407 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
408 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
409 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
410 | GCC_PREFIX_HEADER = "UITextField-Blocks Example/UITextField-Blocks Example-Prefix.pch";
411 | INFOPLIST_FILE = "UITextField-Blocks Example/UITextField-Blocks Example-Info.plist";
412 | PRODUCT_NAME = "$(TARGET_NAME)";
413 | WRAPPER_EXTENSION = app;
414 | };
415 | name = Release;
416 | };
417 | 83FB8C421813EF7000DEA8EB /* Debug */ = {
418 | isa = XCBuildConfiguration;
419 | buildSettings = {
420 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
421 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/UITextField-Blocks Example.app/UITextField-Blocks Example";
422 | FRAMEWORK_SEARCH_PATHS = (
423 | "$(SDKROOT)/Developer/Library/Frameworks",
424 | "$(inherited)",
425 | "$(DEVELOPER_FRAMEWORKS_DIR)",
426 | );
427 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
428 | GCC_PREFIX_HEADER = "UITextField-Blocks Example/UITextField-Blocks Example-Prefix.pch";
429 | GCC_PREPROCESSOR_DEFINITIONS = (
430 | "DEBUG=1",
431 | "$(inherited)",
432 | );
433 | INFOPLIST_FILE = "UITextField-Blocks ExampleTests/UITextField-Blocks ExampleTests-Info.plist";
434 | PRODUCT_NAME = "$(TARGET_NAME)";
435 | TEST_HOST = "$(BUNDLE_LOADER)";
436 | WRAPPER_EXTENSION = xctest;
437 | };
438 | name = Debug;
439 | };
440 | 83FB8C431813EF7000DEA8EB /* Release */ = {
441 | isa = XCBuildConfiguration;
442 | buildSettings = {
443 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
444 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/UITextField-Blocks Example.app/UITextField-Blocks Example";
445 | FRAMEWORK_SEARCH_PATHS = (
446 | "$(SDKROOT)/Developer/Library/Frameworks",
447 | "$(inherited)",
448 | "$(DEVELOPER_FRAMEWORKS_DIR)",
449 | );
450 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
451 | GCC_PREFIX_HEADER = "UITextField-Blocks Example/UITextField-Blocks Example-Prefix.pch";
452 | INFOPLIST_FILE = "UITextField-Blocks ExampleTests/UITextField-Blocks ExampleTests-Info.plist";
453 | PRODUCT_NAME = "$(TARGET_NAME)";
454 | TEST_HOST = "$(BUNDLE_LOADER)";
455 | WRAPPER_EXTENSION = xctest;
456 | };
457 | name = Release;
458 | };
459 | /* End XCBuildConfiguration section */
460 |
461 | /* Begin XCConfigurationList section */
462 | 83FB8C071813EF7000DEA8EB /* Build configuration list for PBXProject "UITextField-Blocks Example" */ = {
463 | isa = XCConfigurationList;
464 | buildConfigurations = (
465 | 83FB8C3C1813EF7000DEA8EB /* Debug */,
466 | 83FB8C3D1813EF7000DEA8EB /* Release */,
467 | );
468 | defaultConfigurationIsVisible = 0;
469 | defaultConfigurationName = Release;
470 | };
471 | 83FB8C3E1813EF7000DEA8EB /* Build configuration list for PBXNativeTarget "UITextField-Blocks Example" */ = {
472 | isa = XCConfigurationList;
473 | buildConfigurations = (
474 | 83FB8C3F1813EF7000DEA8EB /* Debug */,
475 | 83FB8C401813EF7000DEA8EB /* Release */,
476 | );
477 | defaultConfigurationIsVisible = 0;
478 | };
479 | 83FB8C411813EF7000DEA8EB /* Build configuration list for PBXNativeTarget "UITextField-Blocks ExampleTests" */ = {
480 | isa = XCConfigurationList;
481 | buildConfigurations = (
482 | 83FB8C421813EF7000DEA8EB /* Debug */,
483 | 83FB8C431813EF7000DEA8EB /* Release */,
484 | );
485 | defaultConfigurationIsVisible = 0;
486 | };
487 | /* End XCConfigurationList section */
488 | };
489 | rootObject = 83FB8C041813EF7000DEA8EB /* Project object */;
490 | }
491 |
--------------------------------------------------------------------------------