I think I finally figured out a solution to this annoying problem! 😅 🎉 I created a new separate project with a simplified version of the code only for debugging. **The solution:** It turns out that it's possible to wrap the `ScrollView` in a `GeometryReader` which calculates the total window space. Then I am using the value from the `GeometryReader` to calculate the total height without the header. The header is the blue box that contains the document name and information like word counter. The calculation is simply `geometry.size.height - headerHeight` and now I have the minHeight value for the `NSTextView`. It's even a dynamic value that updates when the user resizes the window. From web development, I'm used to just being able to say `width: 100%` and then it works, but with native development, it's not as easy 😂 #dev #Swift #AppKit image
Frederik Handberg's avatar Frederik Handberg
Will look at it again today. Hopefully I can find a solution. It can’t be this difficult just to get a `NSTextView` to stretch full height inside a `ScrollView`… View quoted note →
View quoted note →

Replies (2)

I just lost my WiFi… I was literally about to make a PR to merge my changes into the main branch. Maybe this is a sign I should test a bit more before merging 🤔
WiFi is back again and I just merged to main branch. There’s a bug that happens if I switch between different notes, the Markdown doesn’t render until I click the `NSTextView` and make a change, like adding an empty space or anything else.