Swift Compiler Error: Type 'UITextView' has no member 'textDidChangeNotification'
Using v1.4.0 from cocoapods (latest as of the writing of this post).
In the file "NextGrowingInternalTextView.swift", the "addObserver" line from the code snippet below has an error with the name input parameter, saying "Type 'UITextView' has no member 'textDidChangeNotification'."
I have spent hours trying to determine why textDidChangeNotification is not being recognized. I have removed the dependency, added it back, cleaned, and rebuilt multiple times to no avail. Perhaps it is deprecated in Swift 4. Would appreciate some help on this. Thanks!
override init(frame: CGRect, textContainer: NSTextContainer?) {
super.init(frame: frame, textContainer: textContainer)
NotificationCenter.default.addObserver(self, selector: #selector(NextGrowingInternalTextView.textDidChangeNotification(_ :)), name: UITextView.textDidChangeNotification, object: self)
}
I also had same problem. (using Swift4.0)
I changed UITextView.textDidChangeNotification into .UITextViewTextDidChange and fixed this issue.
https://github.com/jtaka1012/NextGrowingTextView/commit/232b127cd1aefde5927113b119fb562cb343b9b1
I think that this fix works correctly.
But, I don't know that if this fix will work under Swift 4.2.
i also had same issue facing with swift 4.2.0
NSNotification.Name.UITextViewTextDidChange Swift 4.2
thank you @jtaka1012