Skip to content

Commit 9ca08c6

Browse files
committed
Add to resolve splitview crash
1 parent 986617e commit 9ca08c6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Sources/STTextViewSwiftUIAppKit/TextView.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ private struct TextViewRepresentable: NSViewRepresentable {
121121

122122
return scrollView
123123
}
124+
125+
func sizeThatFits(_ proposal: ProposedViewSize, nsView: NSScrollView, context: Context) -> CGSize? {
126+
let width = proposal.width ?? nsView.frame.size.width
127+
let height = proposal.height ?? nsView.frame.size.height
128+
return CGSize(width: width, height: height)
129+
}
124130

125131
func updateNSView(_ scrollView: NSScrollView, context: Context) {
126132
let textView = scrollView.documentView as! STTextView

0 commit comments

Comments
 (0)