Commit 041b171
authored
Resolve crash within NavigationSplitView in v2.3.4 (#102)
Hey! Per your recommendation, we (Bitrig) updated `STTextView` to v2.3.4
today. Unfortunately, this caused our app to crash on launch when using
`STTextView` within a `SwiftUI.NavigationSplitView`.
Sample code:
```swift
struct ContentView: View {
var body: some View {
NavigationSplitView {
Spacer()
} detail: {
TextView(
text: .constant(.init("Wow"))
)
.font(.system(size: 12, weight: .regular, design: .monospaced))
}
}
}
```
<img width="703" height="212" alt="Screenshot 2026-01-14 at 3 29 16 PM"
src="https://github.com/user-attachments/assets/b7ce1e07-ec8d-4b8c-bd12-15a584223004"
/>
I investigated the crash and believe it was caused by an invalidation
loop from `NavigationSplitView` while `STTextView` is resizing during
layout.
I found that implementing `sizeThatFits` to accept SwiftUI's size
proposal resolves the crash.
We have already made this change in our internal source editor package.
I'm making this PR to share the fix with other users as well in case
it's helpful. Thank you!1 parent 986617e commit 041b171
1 file changed
+6
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
124 | 130 | | |
125 | 131 | | |
126 | 132 | | |
| |||
0 commit comments