| 12345678910111213141516171819202122232425262728293031323334 |
- //
- // LNAutoSizeTextView.swift
- // Lanu
- //
- // Created by OneeChan on 2025/11/14.
- //
- import Foundation
- import UIKit
- import SnapKit
- class LNAutoSizeTextView: UITextView {
- override var contentSize: CGSize {
- didSet {
- guard contentSize.height > 0 else { return }
- snp.updateConstraints { make in
- make.height.equalTo(contentSize.height).priority(.medium)
- }
- }
- }
-
- override init(frame: CGRect, textContainer: NSTextContainer?) {
- super.init(frame: frame, textContainer: textContainer)
-
- snp.makeConstraints { make in
- make.height.equalTo(0).priority(.medium)
- }
- }
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- }
|