{"id":13696384,"url":"https://github.com/tingxins/InputKit","last_synced_at":"2025-05-03T17:31:01.255Z","repository":{"id":56915526,"uuid":"93112735","full_name":"tingxins/InputKit","owner":"tingxins","description":"📝InputKit, an Elegant Kit to limits your input text, inspired by BlocksKit, written in both Objective-C \u0026 ⚡️Swift.","archived":false,"fork":false,"pushed_at":"2019-03-26T03:06:56.000Z","size":120,"stargazers_count":430,"open_issues_count":9,"forks_count":63,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-07T13:42:53.454Z","etag":null,"topics":["input","ios","limited","objective-c","restrictions","swift","text","textfield","textview"],"latest_commit_sha":null,"homepage":"https://tingxins.com/2017/06/input-kit-introduction/","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tingxins.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-02T01:02:12.000Z","updated_at":"2024-07-27T07:00:40.000Z","dependencies_parsed_at":"2022-08-21T03:50:27.415Z","dependency_job_id":null,"html_url":"https://github.com/tingxins/InputKit","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tingxins%2FInputKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tingxins%2FInputKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tingxins%2FInputKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tingxins%2FInputKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tingxins","download_url":"https://codeload.github.com/tingxins/InputKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224099572,"owners_count":17255578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["input","ios","limited","objective-c","restrictions","swift","text","textfield","textview"],"created_at":"2024-08-02T18:00:39.080Z","updated_at":"2024-11-13T00:30:26.334Z","avatar_url":"https://github.com/tingxins.png","language":"Objective-C","readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"http://image.tingxins.cn/InputKit/InputKit-logo2-dynamic.gif\" width=888/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"http://cocoadocs.org/docsets/InputKit\"\u003e\u003cimg src=\"https://img.shields.io/badge/Pod-compatible-4BC51D.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/Carthage/Carthage\"\u003e\u003cimg src=\"https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/tingxins/InputKit\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/p/InputKit.svg?style=flat\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/tingxins/InputKit\"\u003e\u003cimg src=\"https://img.shields.io/badge/support-iOS%208%2B-brightgreen.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.apache.org/licenses/LICENSE-2.0.html\"\u003e\u003cimg src=\"http://img.shields.io/cocoapods/l/InputKit.svg?style=flat\"\u003e\u003c/a\u003e\n\n\u003c/p\u003e\n\n**InputKit** is an Elegant Kit to limits your input text, inspired by [BlocksKit](https://github.com/zwaldowski/BlocksKit), written in both Objective-C \u0026 Swift.\n\n\u003e [中文介绍](http://www.jianshu.com/p/c592c2dc9733)\n\n# Language \n\n\u003cp align=\"left\"\u003e\n    \u003ca href=\"https://github.com/apple/swift\"\u003e\u003cimg src=\"https://img.shields.io/badge/language-Objectivc--C-blue.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"http://cocoadocs.org/docsets/InputKit\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/v/InputKit.svg?style=social\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"left\"\u003e\n    \u003ca href=\"https://github.com/apple/swift\"\u003e\u003cimg src=\"https://img.shields.io/badge/language-Swift%204.2%20-orange.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"http://cocoadocs.org/docsets/InputKitSwift\"\u003e\u003cimg src=\"https://img.shields.io/cocoapods/v/InputKitSwift.svg?style=social\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"left\"\u003e\n    \u003ca href=\"https://github.com/apple/swift\"\u003e\u003cimg src=\"https://img.shields.io/badge/language-Swift 3.x-orange.svg\"\u003e\u003c/a\u003e\n    \u003ca href=\"http://cocoadocs.org/docsets/InputKitSwift\"\u003e\u003cimg src=\"https://img.shields.io/badge/pod-v1.1.14-green.svg?style=social\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\n# Installation\n\nThere are three ways to use InputKit in your project:\n\n* Using CocoaPods\n\n* Manual\n\n* Using Carthage\n\n## CocoaPods\n    \nCocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries in your projects. \n\n### Podfile\n\n    platform :ios, '8.0'\n\n#### Objective-C\n\n    pod 'InputKit', '~\u003e 1.1.15'\n\n#### Swift 3.x\n\n    pod 'InputKitSwift', '~\u003e 1.1.14'\n\n#### Swift 4.0\n\n    pod 'InputKitSwift', '~\u003e 1.1.16'\n\n\n## Manual\n\nDownload repo's zip, and just drag **ALL** files in the InputKit folder to your projects.\n\n## Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.\n\nYou can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n    $ brew update\n    $ brew install carthage\n        \nTo integrate **InputKit** or **InputKitSwift** into your Xcode project using Carthage, specify it in your Cartfile:\n\n    github \"tingxins/InputKit\"\n\nRun carthage to build the frameworks and drag the appropriate framework (InputKit.framework or InputKitSwift.framework) into your Xcode project according to your need. Make sure to add only one framework and not both.\n    \n# Usage \n\nYou can running **InputKitDemo** for more details.\n\n## Using Code\n\nFirst, import header file when you are using.\n    \n    #import \"InputKit.h\"\n    \n### For UITextField:\n\nUsing TXLimitedTextField class instead.\n\n**TXLimitedTextFieldTypeDefault:**\n\nThe type of **TXLimitedTextFieldTypeDefault** is just limits the number of characters for TXLimitedTextField that you input, and you can input any characters if you wanted, such as Chinese, Alphabet or Special Characters, e.g. \n\nExample:\n\n```\n\nTXLimitedTextField *textField = [[TXLimitedTextField alloc] initWithFrame:CGRectMake(20, 200, 100, 30)];\n\n// Of course, you can ignored this line of codes. TXLimitedTextFieldTypeDefault is default.\ntextField.limitedType = TXLimitedTextFieldTypeDefault;\n\n// this means, you can only input ten characters. It limits the max number of characters that you input.\ntextField.limitedNumber = 10;\n\n[self.view addSubview:textField];\n\n```\n\n![inputKit-demo-default](http://image.tingxins.cn/InputKit/inputKit-demo-default.gif)\n\n**TXLimitedTextFieldTypePrice:**\n\nThe type of **TXLimitedTextFieldTypePrice** is not only limits the number of characters that you input, and can do more useful limited for your textfield. we usually used in TXLimitedTextField that only need to input int or decimal number. \n\nExample:\n\n```\n\nTXLimitedTextField *textField = [[TXLimitedTextField alloc] initWithFrame:CGRectMake(20, 200, 100, 30)];\n\n// Type\ntextField.limitedType = TXLimitedTextFieldTypePrice;\n\n// you can also set the property in this type. It limits the max number of characters that you input\ntextField.limitedNumber = 10;\n\n// this means, that only five ints can be inputted\ntextField.limitedPrefix = 5;\n\n// this means, that only five decimal can be inputted\ntextField.limitedSuffix = 2;\n\n[self.view addSubview:textField];\n\n```\n\n![inputKit-demo-price](http://image.tingxins.cn/InputKit/inputKit-demo-price.gif)\n\n**TXLimitedTextFieldTypeCustom:**\n\nThis type of **TXLimitedTextFieldTypeCustom** is interesting. you can custom your own TXLimitedTextField, just using your regular expression. but some notes must be noticed when you using. \n\nExample:\n\n```\n\nTXLimitedTextField *textField = [[TXLimitedTextField alloc] initWithFrame:CGRectMake(20, 200, 100, 30)];\n\n// Of course, you can custom your field\ntextField.limitedType = TXLimitedTextFieldTypeCustom;\n\n// you can also set the property in this type. It limits the max number of characters that you input\ntextField.limitedNumber = 10;\n\n// limitedRegExs is a type of array argument that you can via it, and pass your regular expression to TXLimitedTextField. kTXLimitedTextFieldChineseOnlyRegex is a constant that define in TXMatchConst.h file. it's represent that only Chinese characters can be inputted.\ntextField.limitedRegExs = @[kTXLimitedTextFieldChineseOnlyRegex];\n\n[self.view addSubview:textField];\n\n```\n\n![inputKit-demo-custom](http://image.tingxins.cn/InputKit/inputKit-demo-custom.gif)\n\n## Using Nib\n\nInputKit accessible from the **Attributes Inspector**. These attributes have been available:\n\n![inputKit-demo-inspector-en](http://image.tingxins.cn/InputKit/InputKit-demo-inspector-en.png)\n\n## About Callback\n\nIf you want to get a callback when you are input limited text, you should have to do this:\n\n1. Set the delegate of your TXLimitedTextField: \n\n    ```\n    \n    self.limitedTextField.delegate = self;\n    \n    ```\n    \n2. Implement -inputKitDidLimitedIllegalInputText: method:\n\n    ```\n    #pragma mark - InputKit \n    \n    - (void)inputKitDidLimitedIllegalInputText:(id)obj {\n        NSLog(@\"If you are input text that limited. this method will be callback. you may do some here!\");\n    }\n    \n    ```\n    \n    \n## Other\n    \n#### Compatible with ReactiveCocoa\n\nIf you are using `ReactiveCocoa` in your Projects, please do make sure to set  instance property of `compatibleWithRAC` = YES.(**default is NO**). Thanks for @**devcxm** open this issue in GitHub.\n\nSample Code:\n\n```\n\nTXLimitedTextView *limitedTextView = [[TXLimitedTextView alloc] initWithFrame:CGRectMake(20.f, 100.f, 120.f, 30.f)];\n// If you are using `ReactiveCocoa` somewhere in your Projects, please make sure this property = YES\nlimitedTextView.compatibleWithRAC = YES;\nlimitedTextView.delegate = self;\nlimitedTextView.limitedNumber = 5;\n[self.view addSubview:limitedTextView];\n\n[limitedTextView.rac_textSignal subscribeNext:^(NSString * _Nullable x) {\n  NSLog(@\"come here ... %@\", x);\n}];\n\n//....Enjoy it!👀\n\n```\n\n\n    \n# Communication\n\nAbsolutely，you can contribute to this project all the time if you want to.\n\n- If you **need help or ask general question**, just [**@tingxins**](http://weibo.com/tingxins) in [Weibo](http://weibo.com/tingxins) or [Twitter](https://twitter.com/tingxins), ofcourse, you can access to my [**blog**](https://tingxins.com).\n\n- If you **found a bug**, just open an issue.\n\n- If you **have a feature request**, just open an issue.\n\n- If you **want to contribute**, fork this repository, and then submit a pull request.\n\n# License\n\n`InputKit` is available under the MIT license. See the LICENSE file for more info.\n\n## Ad\n\nWelcome to my Official Account of WeChat.\n\n![wechat-qrcode](http://image.tingxins.cn/adv/wechat-qrcode.jpg)\n\n\n","funding_links":[],"categories":["UI Components"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftingxins%2FInputKit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftingxins%2FInputKit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftingxins%2FInputKit/lists"}