Latest 1.0.2
Homepage https://github.com/Kyohei-Sakai/SimpleCustomizableTextView
License MIT
Platforms ios 8.0
Authors

Simple customizable UITextView subclass that adds Placeholder and ToolBar written in Swift.

Features

Platform
Carthage compatible
License
![Language](http://img.shields.io/badge/language-swift 3.0-orange.svg?style=flat
)

  • Placeholder similar to UITextField
  • AccessryView on keyboard
  • Closing keyboard
  • Support @IBDesignable and @IBInspectable
  • Support Swift 3.0
  • Compatible with Carthage

Demo App

To run the example project, clone the repo, and run pod install from the Example directory first.

Open Example/SimpleCustomizableTextView.xcworkspace and run SimpleCustomizableTextView-Example to see a simple demonstration.

Usage

Initialization

SimpleCustomizableTextView can be initialized in a way same as UITextView

let textView = SimpleCustomizableTextView(frame: CGRect(x: 10, y: 20, width: 200, height: 300))

SimpleCustomizableTextView is available in Interface Builder.
Set custom class of UITextView to SimpleCustomizableTextView

@IBOutlet weak var textView: SimpleCustomizableTextView!

Placeholder setting

Please set text placeholder property.

textView.placeholder = "Set placeholder in SimpleCustomizableTextView."

AccessaryView setting

SimpleCustomizableTextView have customizable accessaryView on keyboard.
You can close a keyboard if you push UIBarButtonItem.

/// set gif ///

if you want to change accessaryView style, you should use accessoryViewStyle, barItemTitle, barItemTitleColor, barItemTitleFont.

textView.accessoryViewStyle = .blackOpaque          // default is .default
textView.barItemTitle = "Close"                     // default is "Done"
textView.barItemTitleColor = UIColor.white          // default is UIColor.black
textView.barItemTitleFont = UIFont.italicSystemFont(ofSize: 20) // default is .systemFont(ofSize: UIFont.buttonFontSize)

if you don’t use accessaryView, set accessoryViewIsHidden to ture.

textView.accessoryViewIsHidden = ture

SimpleCustomizableTextViewDelegate

Asks the delegate if the SimpleCustomizableTextView should process the pressing of the bar button.
true if the SimpleCustomizableTextView should implement its default behavior for the bar button; otherwise, false.

if you set false, the keyboard is not closed.

extension ViewController: SimpleCustomizableTextViewDelegate {
    public func SimpleCustomizableTextViewShouldDone(_ textView: SimpleCustomizableTextView) -> Bool {
        // do something (if you want to implement any behavior before closing the keyboard)
        return true
    }
}

Requirements

  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3.0+

Installation

CocoaPods

SimpleCustomizableTextView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SimpleCustomizableTextView"

Carthage

Add the following line to your Cartfile:

github "Kyohei-Sakai/SimpleCustomizableTextView"

Author

Kyohei-Sakai, [email protected]

License

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

Latest podspec

{
    "name": "SimpleCustomizableTextView",
    "version": "1.0.2",
    "summary": "Simple customizable UITextView subclass in Swift.",
    "description": "SimpleCustomizableTextView is a simple customizable UITextView subclass, written in Swift.nn* Placeholder similar to UITextFieldn* AccessryView on keyboardn* Closing keyboardn* Support @IBDesignable and @IBInspectablen* Support Swift 3.0n* Compatible with Carthage",
    "homepage": "https://github.com/Kyohei-Sakai/SimpleCustomizableTextView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kyohei-Sakai": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Kyohei-Sakai/SimpleCustomizableTextView.git",
        "tag": "1.0.2"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "SimpleCustomizableTextView/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This