Convert Figma logo to code with AI

FluidGroup logoNextGrowingTextView

📝 The next in the generations of 'growing textviews' optimized for iOS 8 and above.

1,802
149
1,802
30

Top Related Projects

⛔️**DEPRECATED** ⛔️ A drop-in UIViewController subclass with a growing text input view and other useful messaging features

8,846

Powerful text framework for iOS to display and edit rich text.

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.

Android PagerTabStrip for iOS.

An elegant messages UI library for iOS

Quick Overview

NextGrowingTextView is a Swift library that provides a growing text view component for iOS applications. It automatically expands and contracts based on the content, making it ideal for chat interfaces, comment sections, or any scenario where dynamic text input is required.

Pros

  • Seamless auto-resizing functionality
  • Customizable maximum and minimum height
  • Supports Swift and is compatible with modern iOS versions
  • Easy integration with existing UIKit-based projects

Cons

  • Limited documentation and examples
  • May require additional configuration for complex layouts
  • Not actively maintained (last update was over a year ago)
  • Lacks SwiftUI support

Code Examples

  1. Basic usage:
let growingTextView = NextGrowingTextView()
view.addSubview(growingTextView)
  1. Customizing appearance:
growingTextView.textView.font = UIFont.systemFont(ofSize: 16)
growingTextView.textView.textColor = .darkGray
growingTextView.backgroundColor = .lightGray
  1. Setting maximum height:
growingTextView.maxHeight = 100
  1. Handling text changes:
growingTextView.delegates.didChangeHeight = { [weak self] height in
    self?.updateLayoutForTextViewHeight(height)
}

Getting Started

To use NextGrowingTextView in your project:

  1. Add the following to your Podfile:

    pod 'NextGrowingTextView'
    
  2. Run pod install in your terminal.

  3. Import the library in your Swift file:

    import NextGrowingTextView
    
  4. Create and configure a NextGrowingTextView instance:

    let growingTextView = NextGrowingTextView()
    growingTextView.frame = CGRect(x: 0, y: 0, width: 300, height: 40)
    view.addSubview(growingTextView)
    
  5. Customize as needed and add any necessary constraints or delegates.

Competitor Comparisons

⛔️**DEPRECATED** ⛔️ A drop-in UIViewController subclass with a growing text input view and other useful messaging features

Pros of SlackTextViewController

  • More comprehensive feature set, including autocomplete, mentions, and custom input accessory views
  • Better performance for handling large amounts of text and attachments
  • More mature and battle-tested in production environments

Cons of SlackTextViewController

  • Larger codebase and potentially more complex to integrate
  • Less frequent updates and maintenance compared to NextGrowingTextView
  • Heavier dependency that may increase app size

Code Comparison

NextGrowingTextView:

let growingTextView = NextGrowingTextView()
view.addSubview(growingTextView)
growingTextView.maxNumberOfLines = 3
growingTextView.minNumberOfLines = 1
growingTextView.placeholderAttributedText = NSAttributedString(string: "Enter text...")

SlackTextViewController:

let slackTextViewController = SLKTextViewController()
slackTextViewController.textView.placeholder = "Enter text..."
slackTextViewController.bounces = true
slackTextViewController.shakeToClearEnabled = true
slackTextViewController.keyboardPanningEnabled = true

Both libraries provide growing text views for iOS, but SlackTextViewController offers a more feature-rich solution at the cost of increased complexity. NextGrowingTextView is simpler and more lightweight, making it easier to integrate for basic growing text view needs. The choice between the two depends on the specific requirements of your project and the level of customization needed.

8,846

Powerful text framework for iOS to display and edit rich text.

Pros of YYText

  • More comprehensive text rendering and manipulation capabilities
  • Supports asynchronous rendering for improved performance
  • Offers rich text editing features and custom text containers

Cons of YYText

  • More complex to implement and integrate
  • Larger codebase, potentially increasing app size
  • May be overkill for simple text view requirements

Code Comparison

NextGrowingTextView:

let textView = NextGrowingTextView()
textView.minHeight = 30
textView.maxHeight = 100
textView.placeholderAttributedText = NSAttributedString(string: "Enter text...")

YYText:

YYTextView *textView = [YYTextView new];
textView.font = [UIFont systemFontOfSize:16];
textView.textContainerInset = UIEdgeInsetsMake(10, 10, 10, 10);
textView.delegate = self;
[textView setAttributedText:[[NSAttributedString alloc] initWithString:@"Enter text..."]];

Summary

NextGrowingTextView is a simpler, more focused solution for creating auto-growing text views in iOS applications. It's easier to implement and suitable for basic text input needs. YYText, on the other hand, offers a more feature-rich text rendering and editing experience, with advanced capabilities like asynchronous rendering and custom text containers. However, it comes with a steeper learning curve and may be excessive for simpler use cases. The choice between the two depends on the specific requirements of your project and the level of text manipulation needed.

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more.

Pros of IQKeyboardManager

  • Comprehensive keyboard management solution for iOS
  • Automatic handling of keyboard appearance and dismissal
  • Supports various UI elements like UITextField, UITextView, and UIWebView

Cons of IQKeyboardManager

  • May introduce unnecessary complexity for simpler projects
  • Potential conflicts with custom keyboard handling implementations
  • Larger codebase and potential performance impact

Code Comparison

NextGrowingTextView:

let textView = NextGrowingTextView()
textView.maxNumberOfLines = 3
textView.minNumberOfLines = 1

IQKeyboardManager:

IQKeyboardManager.shared.enable = true
IQKeyboardManager.shared.enableAutoToolbar = false
IQKeyboardManager.shared.keyboardDistanceFromTextField = 10

NextGrowingTextView focuses specifically on creating a growing text view, while IQKeyboardManager provides a more comprehensive keyboard management solution. NextGrowingTextView offers a simpler implementation for projects that only require a growing text view, whereas IQKeyboardManager is better suited for projects needing extensive keyboard handling across various UI elements.

Android PagerTabStrip for iOS.

Pros of XLPagerTabStrip

  • Offers a wide range of customizable paging styles (button bar, segmented control, etc.)
  • Supports both top and bottom tab placement
  • Provides smooth animations and transitions between tabs

Cons of XLPagerTabStrip

  • More complex setup and configuration compared to NextGrowingTextView
  • Larger codebase and potentially higher memory footprint
  • May require more maintenance due to its broader feature set

Code Comparison

NextGrowingTextView:

let growingTextView = NextGrowingTextView()
growingTextView.maxLength = 100
growingTextView.placeholderAttributedText = NSAttributedString(string: "Enter text...")

XLPagerTabStrip:

class MyPagerViewController: ButtonBarPagerTabStripViewController {
    override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
        return [FirstViewController(), SecondViewController(), ThirdViewController()]
    }
}

While NextGrowingTextView focuses on providing a growing text view component, XLPagerTabStrip offers a complete paging solution with various tab styles. NextGrowingTextView is simpler to implement for basic text input needs, while XLPagerTabStrip provides more flexibility for complex view hierarchies and navigation patterns.

An elegant messages UI library for iOS

Pros of JSQMessagesViewController

  • More comprehensive messaging UI solution, including features like avatars, timestamps, and message bubbles
  • Highly customizable appearance and behavior
  • Extensive documentation and community support

Cons of JSQMessagesViewController

  • Larger codebase and potentially more complex integration
  • May include unnecessary features for simpler messaging needs
  • No longer actively maintained (last update in 2017)

Code Comparison

NextGrowingTextView focuses on a growing text view:

let growingTextView = NextGrowingTextView()
growingTextView.maxNumberOfLines = 3
growingTextView.minNumberOfLines = 1

JSQMessagesViewController provides a full messaging interface:

let messagesViewController = JSQMessagesViewController()
messagesViewController.senderId = "user123"
messagesViewController.senderDisplayName = "John Doe"
messagesViewController.collectionView.collectionViewLayout.incomingAvatarViewSize = CGSize(width: 30, height: 30)
messagesViewController.collectionView.collectionViewLayout.outgoingAvatarViewSize = CGSize.zero

NextGrowingTextView is more focused on providing a flexible text input component, while JSQMessagesViewController offers a complete messaging UI solution with additional features. The choice between the two depends on the specific requirements of your project and the level of customization needed.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

NextGrowingTextView
(An Essential UI component for input text)

flexible widthfixed width

💡
Displaying the user-interface on top of the keyboard
muukii/Bureau enables you to show your user-interface on top of the keyboard in the easiest way.

How to use

  1. Create an instance
  2. Add subview with layout

It supports AutoLayout completely.

let growingTextView = NextGrowingTextView()

Setting up with configuration

growingTextView.configuration = .init(
  minLines: 1,
  maxLines: 10,
  isAutomaticScrollToBottomEnabled: true,
  isFlashScrollIndicatorsEnabled: true
)

Accessing actual UITextView to apply settings

growingTextView.textView

Accessing UILabel for displaying placeholder

growingTextView.placeholderLabel

Requirements

iOS 9.0+ Swift 5.5+

Installation

  • Supports the following:
    • CocoaPods
    • Swift Package Manager

Author

muukii

License

NextGrowingTextView is available under the MIT license. See the LICENSE file for more info.

FOSSA Status