{"id":2961,"url":"https://github.com/KennethTsang/GrowingTextView","last_synced_at":"2025-08-06T14:32:54.802Z","repository":{"id":41811342,"uuid":"51890640","full_name":"KennethTsang/GrowingTextView","owner":"KennethTsang","description":"An UITextView in Swift. Support auto growing, placeholder and length limit.","archived":false,"fork":false,"pushed_at":"2022-10-11T12:15:29.000Z","size":1064,"stargazers_count":1086,"open_issues_count":22,"forks_count":135,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-07-26T11:02:33.601Z","etag":null,"topics":["chat","growing","growingtextview","messaging","placeholder","swift","uitextview"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/KennethTsang.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":"2016-02-17T03:17:55.000Z","updated_at":"2025-07-22T16:50:44.000Z","dependencies_parsed_at":"2022-07-17T06:00:46.008Z","dependency_job_id":null,"html_url":"https://github.com/KennethTsang/GrowingTextView","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"purl":"pkg:github/KennethTsang/GrowingTextView","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethTsang%2FGrowingTextView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethTsang%2FGrowingTextView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethTsang%2FGrowingTextView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethTsang%2FGrowingTextView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KennethTsang","download_url":"https://codeload.github.com/KennethTsang/GrowingTextView/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KennethTsang%2FGrowingTextView/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268410500,"owners_count":24246006,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["chat","growing","growingtextview","messaging","placeholder","swift","uitextview"],"created_at":"2024-01-05T20:16:27.489Z","updated_at":"2025-08-06T14:32:54.491Z","avatar_url":"https://github.com/KennethTsang.png","language":"Swift","readme":"# GrowingTextView\n\n[![Version](https://img.shields.io/cocoapods/v/GrowingTextView.svg?style=flat)](http://cocoapods.org/pods/GrowingTextView)\n[![License](https://img.shields.io/cocoapods/l/GrowingTextView.svg?style=flat)](http://cocoapods.org/pods/GrowingTextView)\n[![Platform](https://img.shields.io/cocoapods/p/GrowingTextView.svg?style=flat)](http://cocoapods.org/pods/GrowingTextView)\n[![Language](https://img.shields.io/badge/Swift-3.0-orange.svg?style=flat)](http://cocoapods.org/pods/GrowingTextView)\n[![Language](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)](http://cocoapods.org/pods/GrowingTextView)\n[![Language](https://img.shields.io/badge/Swift-4.2-orange.svg?style=flat)](http://cocoapods.org/pods/GrowingTextView)\n[![Language](https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat)](http://cocoapods.org/pods/GrowingTextView)\n\n\u003cimg src=\"DEMO.gif\" border=1 style=\"border-color:#eeeeee\"\u003e\n\n## Requirements\n\niOS 8.0 or above\n\n## Installation\n\n#### CocoaPods\n\nGrowingTextView is available through [CocoaPods](http://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\nSwift 5.0\u003cbr\u003e\n\n```ruby\npod 'GrowingTextView', '0.7.2'\n```\n\nSwift 4.2\u003cbr\u003e\n\n```ruby\npod 'GrowingTextView', '0.6.1'\n```\n\nSwift 4.1\u003cbr\u003e\n\n```ruby\npod 'GrowingTextView', '~\u003e 0.5'\n```\n\nSwift 3\u003cbr\u003e\n```ruby\npod 'GrowingTextView', '~\u003e 0.4'\n```\n\nSwift 2.3 (Stopped update since Sep 2016)\u003cbr\u003e\n```ruby\npod 'GrowingTextView', :git =\u003e 'https://github.com/KennethTsang/GrowingTextView.git', :branch =\u003e 'swift2'\n```\n\n#### Carthage\n\nGrowingTextView is also available through\n[Carthage](https://github.com/Carthage/Carthage). To install it, add the following\nline to your Cartfile:\n\nSwift 5.0\u003cbr\u003e\n\n```ruby\ngithub \"KennethTsang/GrowingTextView\" ~\u003e 0.7\n```\n\nSwift 4.2\u003cbr\u003e\n\n```ruby\ngithub \"KennethTsang/GrowingTextView\" ~\u003e 0.6\n```\n\nSwift 4.1\u003cbr\u003e\n\n```ruby\ngithub \"KennethTsang/GrowingTextView\" ~\u003e 0.5\n```\n\nSwift 3\u003cbr\u003e\n```ruby\ngithub \"KennethTsang/GrowingTextView\" ~\u003e 0.4\n```\n\nSwift 2.3 (Stopped update since Sep 2016)\u003cbr\u003e\n```ruby\ngithub \"KennethTsang/GrowingTextView\" \"swift2\"\n```\n\n#### Manually\n\nCopy `GrowingTextView.swift` into your project.\n\n## Usage\n\n**Example**\u003cbr\u003e\n\nGrowingTextview is just a textview, download the example to see how to use it as a input toolbar like other instant messaging apps.\n\n**Using GrowingTextview programmatically**\u003cbr\u003e\n\n```swift\nlet textView = GrowingTextView()\ntextView.delegate = self\naddSubview(textView)\n```\n\n**Using GrowingTextview in Storyboard**\u003cbr\u003e\n\n1. Drag a TextView into Storyboard.\n2. Set class to \"GrowingTextView\".\n3. Set delegate to it's view controller.\n\n\n##### automaticallyAdjustsScrollViewInsets\u003cbr\u003e\n\nSometime the view controller may incorrectly adjust the inset of textview automatically. To avoid this, set `automaticallyAdjustsScrollViewInsets` to `false`\n\n```swift\noverride func viewDidLoad() {\n\tsuper.viewDidLoad()\n\tautomaticallyAdjustsScrollViewInsets = false\n}\n```\n\n## Customization\n\n| Parameter                      | Type                | Description                              | Default                         |\n| ------------------------------ | ------------------- | ---------------------------------------- | ------------------------------- |\n| *maxLength*                    | Int                 | Maximum text length. Exceeded text will be trimmed. 0 means no limit. | *0*                             |\n| *trimWhiteSpaceWhenEndEditing* | Bool                | Trim white space and new line characters when textview did end editing. | *true*                          |\n| *placeholder*                  | String?             | Placeholder text.                        | *nil*                           |\n| *placeholderColor*             | UIColor             | Placeholder text color.                  | UIColor(white: 0.8, alpha: 1.0) |\n| *attributedPlaceholder*        | NSAttributedString? | Attributed Placeholder text.             | *nil*                           |\n| *minHeight*                    | CGFloat             | Minimum height of textview.              | *0.0*                           |\n| *maxHeight*                    | CGFloat             | Maximum height of textview.              | *0.0*                           |\n\n#### Examples\n\n```swift\ntextView.maxLength = 140\ntextView.trimWhiteSpaceWhenEndEditing = false\ntextView.placeholder = \"Say something...\"\ntextView.placeholderColor = UIColor(white: 0.8, alpha: 1.0)\ntextView.minHeight = 25.0\ntextView.maxHeight = 70.0\ntextView.backgroundColor = UIColor.whiteColor()\ntextView.layer.cornerRadius = 4.0\n```\n\n## Animation\n\n1. Adopt `GrowingTextViewDelegate` instead of UITextViewDelegate.\n2. Implement textViewDidChangeHeight.\n3. Call layoutIfNeeded() on superview inside the animation.\n\n```swift\nclass ViewController: UIViewController, GrowingTextViewDelegate {\n\tfunc textViewDidChangeHeight(_ textView: GrowingTextView, height: CGFloat) {\n\t   UIView.animate(withDuration: 0.2) {\n\t       self.view.layoutIfNeeded()\n\t   }\n\t}\n}\n```\n\n\n\n## Delegate\n\n`GrowingTextViewDelegate` is inherited from UITextViewDelegate. You may use it's delegate function as a normal UITextView.\n\n```swift\nclass ViewController: UIViewController, GrowingTextViewDelegate {\n    func textViewDidChange(_ textView: UITextView) {\n    \t...\n    }\n    func textViewDidEndEditing(_ textView: UITextView) {\n    \t...\n    }\n}\n```\n\nCheck out UITextViewDelegate here: [https://developer.apple.com/reference/uikit/uitextviewdelegate](https://developer.apple.com/reference/uikit/uitextviewdelegate)\n\n## Author\n\nKenneth Tsang, kenneth.tsang@me.com\n\n## License\n\nGrowingTextView is available under the MIT license. See the LICENSE file for more info.\n","funding_links":[],"categories":["UI","Libs","Swift","UI [🔝](#readme)","OOM-Leaks-Crash"],"sub_categories":["TextField \u0026 TextView","UI","Other free courses","TextView"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKennethTsang%2FGrowingTextView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FKennethTsang%2FGrowingTextView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FKennethTsang%2FGrowingTextView/lists"}