Damus
Frederik Handberg profile picture
Frederik Handberg
@Frederik Handberg

23 🇩🇰 Studying for a degree in Software Engineering 💻
I enjoy building mobile/desktop apps and embedded projects and working on massive heavy-lift drones.

Also learning to sew garments as a hobby to tailor clothes for myself 🪡

I mostly share progress updates as I'm working on my software and drone projects, and as I learn to sew.

Basically, I just write about my hobbies...

Relays (4)
  • wss://relay.damus.io – read & write
  • wss://relay.nostr.band – read & write
  • wss://relay.snort.social – read & write
  • wss://nostr.oxtr.dev – read & write

Recent Notes

Sebastix · 1d
I suspect that nostr:npub1awthl5gjzpnvlzgmepr46gfg28wdy22pgzrj6ckz3tftemwxh2ksx4t5rs - as a privacy guru - is using more privacy friendlier OS, like GrapheneOS ;-)
Frederik Handberg · 3d
Been fighting with #AppKit and #SwiftUI to solve a height calculation problem. Seems like sometimes AppKit does not realize that the height of the SwiftUI code block view has changed. This leads to a ...
Frederik Handberg profile picture
The problem was caused by an `onChange` not always binding to the attachment. Now the markdown editor is updating its height in all my tests.

There still appears to be one more bug where the code block is moving further and further up the more lines it has. It is very minor but I do notice it when there are like 30 lines in the code block.
Frederik Handberg profile picture
Been fighting with #AppKit and #SwiftUI to solve a height calculation problem. Seems like sometimes AppKit does not realize that the height of the SwiftUI code block view has changed. This leads to a problem when the code block grows in height (e.g. when adding more lines) and then it eventually starts overlapping other elements in the Markdown editor.



I am using `NSTextAttachment` to embed an interactive SwiftUI view as a `NSHostingView` inside `NSTextView`. It's really powerful but I also find it so difficult to work with. Especially when needing to share states/updates between the `HostingView` and the `NSTextView` (which is the outer Markdown editor that the code block is embedded into).

Codex seems to have finally found a semi-working solution to the height calculation problem. At least it works when I open the MD file, close it and reopen, then I can add more lines in code block and the editor will correctly update its height to accommodate the growing code block.

However, if I just open the MD file immediately after having started the app, then begin adding more lines, it will not tell AppKit's `NSTextView` about the height changes leading to overlapping issues. #dev #macOS

2
Frederik Handberg · 3d
In the image, you can see how the code block is overlapping other elements in the Markdown editor.
Frederik Handberg · 3d
The problem was caused by an `onChange` not always binding to the attachment. Now the markdown editor is updating its height in all my tests. There still appears to be one more bug where the code block is moving further and further up the more lines it has. It is very minor but I do notice it when ...