Frederik Handberg's avatar
Frederik Handberg
npub1nj0c...2gqz
23 🇩🇰 Studying for a degree in Software Engineering while building fun projects and working freelance as a News Photographer 📷 I share my software projects, photos and videos from my work as a news photographer, and progress updates as I learn to sew garments. Basically, I just write about my hobbies. frederikhandberg.com
Four people were evacuated from the apartment building and taken to the hospital. Two fire fighters were also taken to the hospital. No one is in critical condition according to authorities. Address: Tordenskjoldsgade in Horsens. #press
Fire in a building on Tordenskjoldsgade in Horsens. Six people have been taken to the hospital. #press
I notice that when I use Gems in Gemini _(which is just a project like in Claude)_ and I upload some files, if I then reload the page, it will often duplicate the same files. Gemini 3.1 Pro is good, but the UX is so much nicer in Claude and Sonnet 4.5 is just as good at coding.
I'm getting a leak somewhere in my formatting notifications (I use `NotificationCenter`). This is causing problems if I have two note documents open in the same window. For example, if I change the block type from text to a heading in one of the notes, then save and go to the other note, it will have completely overridden the data.
Apparently using `.glassEffect()` on the window background will break the functionality of the `.onDrop()` modifier. I wanted the Liquid Glass effect on the window background of my app, so I added the `.glassEffect()` modifier which worked, but then I could not drag-and-drop files in the infinite canvas anymore… Turns out that you need to use the AppKit class called `NSGlassEffectView` instead. Now the `.onDrop()` modifier works again.
A semi truck crashed on its side into a ditch on Vejlevej towards 7130 Juelsminde. #press image
I just finished working on a sidebar overlay for the notes app. When hiding a sidebar, the user can now move their cursor to the edge of the window, to show an overlay of the sidebar. I think it looks nice the way it slides out. I will probably lower the opacity of the sidebar overlays just a bit, so they match the appearance of the app with the translucent blurry background. Because right now, I don’t think the dark solid background color of the sidebar overlays match the app’s appearance. But I’m happy with how this feature turned out! 🚀 #dev #macOS #SwiftUI #AppKit
I made a mini-project with an example of my solution. It's available on GitHub: I can't be the only one who has encountered this problem, so hopefully other SwiftUI and AppKit developers can use it. #dev #macOS #SwiftUI #AppKit View quoted note →
The last problem has been fixed. Now the iBeam cursor will show when hovering either an `NSTextField` or `NSTextView` inside the overlay. But it will not show the iBeam when hovering a text view that is behind the overlay - which is the expected behavior. It's really nice because I now have this `ArrowCursorView()` that I can call throughout my app wherever I am using an overlay. For example, I have a fullscreen search overlay where I also have this cursor problem. Now I can fix it by just calling `.background(ArrowCursorView())` on the overlay. View quoted note →
I had some time to play around with #AppKit to figure out a fix to the problem. #dev #macOS #SwiftUI **Recap of the problem:** When I have an overlay above an `NSTextView`, I don't want the iBeam cursor to show when hovering the overlay. But it will actually change to iBeam because the `NSTextView` is below and it just has higher priority, so it will override the cursor. This does not have a straightforward fix, so I had to figure it out on my own... It was not as simple as I thought. I did end up using both `resetCursorRects()` and `addCursorRect()` as I anticipated, but that alone was not enough... I also had to override `mouseEntered()` in the `NSTextView` to block it from changing `NSCursor` to iBeam whenever `hitView` is true. It would flicker to iBeam when hitting the edge of a text view. By overriding `mouseEntered()` in the text view, I could explicitly tell it NOT to do it by blocking the `NSEvent`. I did the same for `mouseMoved()` and `mouseExited()`. The `hitView` is whatever SwiftUI element I have assigned with `.background(ArrowCursorView())`. After testing, this seems to work perfectly, except for ONE thing 😩 It will not allow showing the iBeam in the search field I have inside the overlay (it also gets overridden), so that will be the next task to solve 😁 View quoted note →
There are many weird quirks when using #SwiftUI and #AppKit. For example, say you have an overlay with an image above an `NSTextView`. You would expect the cursor to **NOT** change to the iBeam when you hover over the image because the text view is behind the overlay. However, it **WILL** actually change to the `NSCursor.iBeam` even though the overlay is above the `NSTextView`. The `NSTextView` just takes higher priority. I don’t know why, and I’m not really sure what the correct approach is to fix this. I don’t actually think there is a correct approach, because to my knowledge, there is nothing in the official documentation about it. I’ve had this problem ever since I began the development of my notes app, and I’ve never managed to completely solve it. But it’s also not something I’ve spent much time on either, though it is really frustrating. It’s something I see many take for granted when it comes to web development, as these things just work by default.
The “tab switcher overlay” (or whatever it should be called…) is now finished. #dev #SwiftUI #AppKit image I’m considering to make the overlay height dynamic so it automatically adjusts to the number of items in the list. Currently it’s just using a fixed height. View quoted note →
The best office is outdoors (at least with the current temperatures). #coding Working on an overlay that appears when clicking the tab which is already selected. There is a search input and a list of most recently opened files. Essentially, it’s just a quick way to open a different file. View quoted note →
Finished the tooltip for the notes app 🚀 It took longer than expected, but that's because I had trouble with the tooltip being displayed below other elements. I also had a problem with the scale and opacity animation. It seems like views will by default animate from the center of the window in a `ZStack`. Not literally be positioned at the center, but the initial position of the tooltip was skewed towards the center point of the window. It turns out that I should not conditionally remove the wrapper, but instead keep it always (the wrapper is used to calculate where tooltips should be relative to the button). Otherwise it will not have time to calculate the coordinates for the tooltip, which means it will fly in from center and then to its final position. Now I'm just keeping the position wrapper always, and then conditionally rendering the tooltips. #dev #macOS #SwiftUI #AppKit View quoted note →
I think the task for today will be to implement a custom tooltip. Perhaps I could also start working on "tab search". Basically, click on the selected tab, and it will then show an overlay that allows the user to quickly search and open a different file in the same tab. Yesterday I fixed the text object in the canvas scaling in a way that was causing pixelation. The problem was that I used the `.scaleEffect`, so I replaced that with a more sophisticated approach where I am scaling the font size instead when zooming in and out. The reason why I was using a `.scaleEffect` was because I had issues with text wrapping when I changed the font size. This is why I opted for a simpler approach - just as a temporary solution. But it seems like I finally found a solution to the word wrapping issue... #dev View quoted note →
Coding outside in nature is goated. Can't wait for summer... ☀️