File tree Expand file tree Collapse file tree
ARGrowingTextView/ARGrowingTextView/Source Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,9 +129,23 @@ open class ARGrowingTextView: UIView {
129129 commonInitialiser ( textContainer: textContainer)
130130 }
131131
132- private func commonInitialiser( textContainer: NSTextContainer ? = nil ) {
132+ private func commonInitialiser( ) {
133+ // Create default text container
134+ let container = NSTextContainer ( size: . zero)
135+ container. widthTracksTextView = true
136+
137+ let layoutManager = NSLayoutManager ( )
138+ layoutManager. addTextContainer ( container)
139+
140+ let textStorage = MarkdownTextStorage ( font: . systemFont( ofSize: 17 ) )
141+ textStorage. addLayoutManager ( layoutManager)
142+
143+ commonInitialiser ( textContainer: container)
144+ }
145+
146+ private func commonInitialiser( textContainer: NSTextContainer ) {
133147 // Initialization code
134- textStorage = textContainer? . layoutManager? . textStorage
148+ textStorage = textContainer. layoutManager? . textStorage
135149
136150 initInternalTextView ( textContainer: textContainer)
137151 addSubview ( internalTextView)
You can’t perform that action at this time.
0 commit comments