Skip to content
A lightweight TextView where can be attached any UIView.
Swift Ruby Objective-C
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Demo
Resources
YanagiText.xcodeproj Initial commit Dec 26, 2019
YanagiText.xcworkspace Initial commit Dec 26, 2019
YanagiText Refactoring Dec 26, 2019
.DS_Store Initial commit Dec 26, 2019
.gitattributes Initial commit Dec 26, 2019
LICENSE Initial commit Dec 26, 2019
README.md Fix a typo Dec 27, 2019
YanagiText.podspec Fix Podspec Dec 26, 2019

README.md

License Swift Version CocoaPods Compatible Carthage compatible


YanagiText 🌿

YanagiText allows us to add any UIView to UITextView!



Installation 📒

CocoaPods

You can use CocoaPods to install YanagiText by adding it to your Podfile:

pod 'YanagiText'

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/YanagiText.framework to an iOS project.

github "YuigaWada/YanagiText"

Manually

  1. Download and drop YanagiText in your project.
  2. Congratulations!



Usage 🔥

YanagiText.getViewString registers a view internally, so you must call this methods via your TextView where you wanna add the view.

@IBOutlet weak var textView: YanagiText!

override func viewDidLoad() {
    super.viewDidLoad()

    // You can add a view to your UITextView
    self.textView.attributedText = self.textView.getViewString(with: anyView, size: anyView.frame.size)
}

If you wanna set YanagiText.isEditable = true, write the following code.

class YourViewController: UIViewController, UITextViewDelegate {

  override func viewDidLoad() {
      super.viewDidLoad()
      self.textView.delegate = self
  }

      ...

  func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
      return self.textView.shouldChangeText(textView, shouldChangeTextIn: range, replacementText: text)
  }



Contribute 👨

We would love you for the contribution to YanagiText, check the LICENSE file for more info.

Others

Yuiga Wada - WebSite Twitter - @YuigaWada

Distributed under the MIT license. See LICENSE for more information.

https://github.com/YuigaWada/YanagiText

You can’t perform that action at this time.