I wanted to know when a text is wrapped by the frame of the text view is there any delimiter with which we can identify whether the text is wrapped or not.
For insta
Swift 5.0
extension UITextView {
func sizeFit(width: CGFloat) -> CGSize {
let fixedWidth = width
let newSize = sizeThatFits(CGSize(width: fixedWidth, height: .greatestFiniteMagnitude))
return CGSize(width: fixedWidth, height: newSize.height)
}
func numberOfLine() -> Int {
let size = self.sizeFit(width: self.bounds.width)
let numLines = Int(size.height / (self.font?.lineHeight ?? 1.0))
return numLines
}
}