Frederik Handberg

Zero-JS Hypermedia Browser

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

Notes (20)

From a learning perspective, I definitely think I’m making the right choice by building natively for each platform, because it lets me experience many different ways of doing things. Every language and framework has its own patterns and philosophies. Because of that, I’m getting a lot of practical experience that in the future, will help me make better implementation decisions. At some point, I’ll need to learn Electron and React Native. It should be easy, considering it’s React, which I’ve already used a lot. Tauri would be cool too, mostly because it’s much less bloated than Electron. But it sure isn't Rust that’s drawing me in… #dev nostr:nevent1qvzqqqqqqypzp8yls8khjhc0tma9tzfjsfrg0kz0cln2fnaxmdwk6w6sljmlltkzqyt8wumn8ghj7un9d3shjtnwdaehgu3wvfskueqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduqzpm9tydg9l0txepmprszzgggjx3e03qq7emgwrv2tfh5ngd50g29lwhhqkz
2025-12-06 13:31:55 from 1 relay(s) View Thread →
It’s difficult not to want to just scrap #AppKit and go all-in on #Electron or #Tauri. If my app was a macOS-exclusive, going the native route would be no problem - but this is not the case… I do want my notes app to be available on all the major platforms (iOS, Android, macOS, Windows, Linux, and the web). Building a native app for each platform is a massive undertaking - even for a large team of developers, let alone a single person. In fact, I would argue it’s naive to believe one person can realistically achieve this (even with LLMs). Sure, it's *possible*, but keep in mind, that you’ll be spending an enormous amount of time pushing every feature to every platform, while your competition using Electron and React Native move much faster. This becomes a big problem from a business perspective. Customers expect you to keep up with the competition, but that is nearly impossible when you're maintaining five separate codebases instead of just two (Electron and React Native where much of the code can be shared). If this project was purely for the sake of business, I probably made the wrong choice by going native 😅 But hey, I'm new to programming, so I think it's good that I'm making all these choices and learning from them. This project is about learning the craft of programming. Of course, I'd love for this project to eventually make a living income - that'd be a dream come true. I started my Software Engineering degree ≈2,5 years ago. I had coded before that, but just some pretty basic Remix and Next.js. I would barely even call that real programming considering how little logic was involved (mostly just mutating state values) to what I'm doing now with AppKit where I'm working with low-level APIs that are poorly documented. #dev
2025-12-06 13:17:47 from 1 relay(s) View Thread →
I’ve been quiet on Nostr. Just been hustling to implement custom solutions to fix the problems I ran into with my notes app - more specifically `NSTextView`. The worst part is, I only have a functional solution for #AppKit (which is for #macOS). When I start developing the #iOS app, I will need to implement the same functionality but this time in #UIKit. I have no idea if UIKit even gives me the control I need for `UITextView` to achieve the same functionality I have with `NSTextView`. The thing is, I’ve never used UIKit before, but I also had no experience with AppKit before starting this project and so far it’s going fine… The functionality I’ve been implementing is to allow navigating the caret across multiple sequential `NSTextView`s. This is essential for my notes app and I finally have a working solution. Only basic stuff is missing like `Cmd+A`, which should select text in all the text views (currently only selects text in the focused text view). I do already have this functionality, but it’s in a different Xcode project, so I’ll need to integrate it into the new one. #dev
2025-12-04 22:13:03 from 1 relay(s) View Thread →
Cooking outside is nice. It’s just a shame it gets dark so early now, so I can’t look over the landscape… #food #burgers image
2025-11-30 08:37:38 from 1 relay(s) View Thread →
I made burgers yesterday on the new gas stove. Crazy how fast it gets warm and ready to use. #food image nostr:nevent1qqsy5xjhzshhh040slety867qdry7gsxd6uv2z738d4wknrv6v4gmtgzyzwflq0d090s7hh62kyn9qjxslvyl3lx5n86dk6ad5a4pl9hl7hvyqcyqqqqqqgpzemhxue69uhhyetvv9ujumn0wd68ytnzv9hxg6w0ade
2025-11-25 08:13:09 from 1 relay(s) View Thread →
Purchased an outdoor gas stove for camping. Let’s cook some bacon 🥓 image image image
2025-11-24 19:51:45 from 1 relay(s) View Thread →
I love that #programming is all about problem solving. That’s what makes it so fun. At the same time, it can also be a disadvantage. Sometimes, I’ll run into a bug and spend days trying to solve it. This can be super frustrating 😫 But then it finally works, and the adrenaline kick feels amazing 🚀
2025-11-22 20:44:35 from 1 relay(s) View Thread →
My previous approach for the editing experience in my notes app was using multiple independent `NSTextView`'s. This caused a problem where I was unable to perform text selection across multiple blocks, since the blocks were in separate `NSTextView`'s. This led me to implement a different solution where I used a single `NSTextView` for all blocks rather than separate. However, now I just found a #GitHub repository that might be a solution: https://github.com/indragiek/INDSequentialTextSelectionManager It's old and uses Objective-C, but Sonnet 4.5 should be able to help port it to Swift. Previous post: nostr:nevent1qvzqqqqqqypzp8yls8khjhc0tma9tzfjsfrg0kz0cln2fnaxmdwk6w6sljmlltkzqy28wumn8ghj7mn0wd68ytn00p68ytnyv4mqz9rhwden5te0wfjkccte9ejxzmt4wvhxjmcpzemhxue69uhhyetvv9ujumn0wd68ytnzv9hxgqgcwaehxw309aex2mrp0yh8xmn0wf6zuum0vd5kzmqqyqtucnt3ay956nlducrw4whyc0y8yz084etdh2lkemagxx6g9tgggsg78ca
2025-11-20 16:48:18 from 1 relay(s) View Thread →
A massive challenge for a #programmer like myself without years of experience is that I don’t really know how things are done. For example, with the notes app I’m building, I’m making so many assumptions about how things should be done. And I’ve had to redo implementations again and again because I realized my approach was bad. This is obviously part of learning, but it still sucks when you think what you just made is really good, and then it turns out it has massive flaws because you just didn’t know any better 😅 #dev
2025-11-20 16:18:09 from 1 relay(s) View Thread →
After learning the shortcut `CMD + Shift + O` my #Xcode experience has improved significantly. It’s exactly like the `CMD + P` shortcut in #VSCode. Just a way to search for files to quickly open them.
2025-11-09 23:05:29 from 1 relay(s) View Thread →
🚨 I have an #AppKit pro tip for y’all that I just learned!!! 🚨 If you have an `NSView` above an `NSTextView` and you want to change `NSCursor` when hovering the `NSView` to something like `NSCursor.pointingHand`, you need to make sure you don't call `super.mouseMoved(with: event)`. If you call `super` on your `mouseMoved` event, it will override the `NSCursor` to the default. The default `NSCursor` for `NSTextView` is the `NSCursor.iBeam`, so you will experience the pointingHand to show very briefly, but then immediately be changed to the iBeam when you hover over the `NSView`. I have spent the past three hours trying to figure out a solution to the cursor flickering and I literally just fixed it. #dev #Swift #AppKit
2025-11-09 22:30:09 from 1 relay(s) View Thread →
I FINALLY have `NSTextAttachmentViewProvider` working in my native #macOS notes app! 🎉 This means I can now display interactive #SwiftUI views inside an `NSTextView`. Notice how I’m embedding an image directly into the textview, which the user can click to show the image in a popup. https://video.nostr.build/d5113f80248fa1420f4d6cd37035d42d1938c1c0d79209e1623ea6e229991214.mp4 It sure did take a lot of trial and error before I could get it working. I did try to use LLMs to help out, but they were hallucinating like crazy - this makes sense though. They learn from gathering data, but there really isn’t much data available online about `NSTextAttachmentViewProvider`. This is unfortunately the case with many of the #AppKit APIs… There just aren't that many resources to be found, which makes learning AppKit much harder compared to, for example, web development (at least I personally found web dev much easier to learn). **The problem I experienced:** The whole point of me trying to use the API, was because I needed to display a SwiftUI view containing an image directly inside an `NSTextView`. This is unsupported by the `NSTextAttachment` API. _Just to be very clear: Yes, I know that you can show an NSImage using `NSTextAttachment`, but you **CANNOT** show a SwiftUI image._ I tried to write some hacks to get it working, but then I learned about the newer API called `NSTextAttachmentViewProvider` which would allow me to do exactly what I wanted - to embed a SwiftUI image inside a textview. However, by using this new API, I had to migrate from `TextKit1` to the newer version `TextKit2`. The migration to the new `TextKit2` went fairly smooth, but getting the images to show correctly inside the `NSTextView` was quite the challenge 😅 My biggest problem was getting the size of the images to work. They seemed to be limited to the line height, which meant, the images couldn’t grow more in height than 32pts. **Re-rendering bug**: You'll notice in the video, that the images are showing the loading indicator very briefly whenever I hover over the heading blocks. This will be my next task to fix. **Hover effect bug:** There's also a problem with the text selection cursor showing even when I'm hovering over an image - it should change to the pointer cursor. It does actually change very briefly, but then changes back to text selection cursor again. #Swift #dev
2025-11-09 16:32:25 from 1 relay(s) View Thread →
nostr:nevent1qqsq5qsarv0mhcza44j3nqycrj6umc3elc0nqaa7pvv9ma92zq60zagzyqlhwrt96wnkf2w9edgr4cfruchvwkv26q6asdhz4qg08pm6w3djgqcyqqqqqqgpp4mhxue69uhkummn9ekx7mqpzemhxue69uhhyetvv9ujumn0wd68ytnzv9hxgqgswaehxw309ahx7um5wgh8w6twv5q95y0g nostr:nevent1qqsfshavnz4jqa7t9skp47mlzr6c8sd3ans3uu7tkuyzuapea3vfdmgzyzwflq0d090s7hh62kyn9qjxslvyl3lx5n86dk6ad5a4pl9hl7hvyqcyqqqqqqgpzemhxue69uhhyetvv9ujumn0wd68ytnzv9hxgqgcwaehxw309aex2mrp0yh8xmn0wf6zuum0vd5kzmqpz3mhxue69uhkummnw3ezummcw3ezuer9wc536jnw It’s hard to get normies on #Nostr. As soon as they learn that their NSEC can’t be recovered or reset, or that discoverability on Nostr is mostly non-existent (except for reposts), they’ll be heading for the exit… The problem with Nostr identities not being recoverable if compromised is a massive problem. It’s my biggest problem with the Nostr protocol. It only takes one mistake where the user pastes their NSEC into a malicious client. As Nostr grows (if it ever does), we will see an increase in malicious clients popping up. Think about building up a following on Nostr just to lose it all because you made one mistake pasting your NSEC into the wrong client. It’s discouraging to creators…
2025-11-07 22:54:34 from 1 relay(s) View Thread →
Apparently, `NSTextAttachment` is very limited in what it can do. Simple things like opacity and scale hover effects aren't possible by default. That's a bummer... 😔 Luckily, I just learned about `NSTextAttachmentViewProvider`, and this one seems to support embedding interactive views in text. This means, I should be able to have a SwiftUI view embedded directly in the `NSTextView`. This SwiftUI view will contain an image with some beautiful animations such as: ```swift .opacity(isHovering ? 0.85 : 1.0) .scaleEffect(isPressed ? 0.97 : 1.0) .animation(.easeInOut(duration: 0.15), value: isHovering) .animation(.spring(response: 0.2, dampingFraction: 0.6), value: isPressed) ``` #dev #Swift #SwiftUI #AppKit nostr:nevent1qvzqqqqqqypzp8yls8khjhc0tma9tzfjsfrg0kz0cln2fnaxmdwk6w6sljmlltkzqy8hwumn8ghj7mn0wd68ytnddaksz9rhwden5te0dehhxarj9ehhsarj9ejx2aspz3mhxue69uhhyetvv9ujuerpd46hxtnfduq3vamnwvaz7tmjv4kxz7fwdehhxarj9e3xzmnyqqspnsavkxla7vxs3rnmw7rcec70klcz6rpsn6dgqfg9qagj6jrhrfgx2xsf5
2025-11-04 16:39:37 from 1 relay(s) View Thread →
Using AI as your support staff is a risky move 😂 image
2025-11-03 22:26:32 from 1 relay(s) View Thread →
I finally figured out a solution to fix the many issues I had with my approach for the editor 😅 https://video.nostr.build/b5d44cefb9a6153336fe9375f56963d37450090ef8a1d7838d8a041675fda900.mp4 Basically, I was using an independent and separate `NSTextView` inside of each block. For example, if I had two text blocks, it would be two separate `NSTextView`s. This was causing issues with caret navigation using the arrow up and down keys. The reason was that the textviews weren’t connected in any way, so I had to implement a custom solution. It mostly worked, but the x-position was sometimes off by a few characters. Another problem was selecting text across multiple blocks. This isn’t possible by default either. I didn’t try to implement a custom solution for this, because I could already see that my approach of using separate textviews was flawed. I would’ve ended up spending a lot of time fixing basic things like text selection not working. I then thought, _what if I could just use a single textview?_ I realized that using `NSMutableAttributedString` could be useful. I spent all of Sunday working on this, but I finally have a solution that seems pretty solid. Now all blocks are displayed in the same textview, so selecting text across multiple blocks finally works 🚀 **Next tasks:** - Get images and videos working using `NSTextAttachment`. - I also need to get the animation working when collapsing a heading, so that the text moves up and its opacity decreases. - The pointer cursor does not show correctly when hovering the ellipsis button. It still shows the text selection cursor. #dev #Swift #AppKit #SwiftUI nostr:nevent1qvzqqqqqqypzp8yls8khjhc0tma9tzfjsfrg0kz0cln2fnaxmdwk6w6sljmlltkzqyt8wumn8ghj7un9d3shjtnwdaehgu3wvfskueqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduqzpvnzzs3jlhukcp4gxax04y7kywdcxn220f2nde464k9jh259rsv07j43jl
2025-11-03 21:57:11 from 1 relay(s) View Thread →
In the current approach, I use an `NSTextView` in each block. This means, if you have two text blocks, there are going to be two separate `NSTextView`s. This is problematic, as it’s really difficult to make keyboard navigation feel natural when navigating the caret between the two text blocks. You know how when you use arrow up and down keys to navigate in some text, the x-position is remembered to ensure the caret stays in the same position on the horizontal axis. I do have a solution that mostly work, but I have a bug where _(I think)_ it resets the x-position on each up and down click. Shouldn’t be too difficult to fix. **However, there is another problematic issue:** Another problem is text selection. Selecting text across two different `NSTextView`s must be faked, as it does not work by default, so I need to implement a custom solution. **I see two options:** - I can continue with the current approach of using separate `NSTextView`s for each block, but this requires much debugging and custom solutions. Maybe I will never be able to get it perfect 🤷‍♂️ - Or, I can pivot and use one single NSTextView which is apparently what Apple Notes is doing. I’m not super familiar with `NSMutableAttributedString` and `NSAttributedString`, but apparently these allow for custom styling inside the same text string. For example, you can have a line with a bigger font size and then a line below with a smaller font size inside the same text paragraph. You can even add attachments inside the text with `NSTextAttachment`. I think this should also work for checkboxes. I will experiment with this new approach over the weekend. Hopefully, I can get something working. #dev #macOS #Swift #AppKit nostr:nevent1qqsqnhum35z2897f9p9xteqktxa2se0py9xhqh39ssap8cv756p9t0czyzwflq0d090s7hh62kyn9qjxslvyl3lx5n86dk6ad5a4pl9hl7hvyqcyqqqqqqgpz3mhxue69uhkummnw3ezummcw3ezuer9wcxx28xn
2025-11-01 10:39:04 from 1 relay(s) View Thread →
I added a new image popup to my #macOS notes app 🚀 https://video.nostr.build/22aed672da66e5a5420961e727607f9d65a3627611eefd922a2a19eb84db15de.mp4 Simply click on an image, and it will open the image in a popup with a blurry and slightly dark background. I think it looks beautiful 🤩 Also added a subtle fade-out effect to the note content right below the tabs at the top. Can't wait to begin working on the iPhone and iPad app, but there's still more to be done on the macOS version 💻 I still need to implemented the visual canvas functionality, which will be a major part of the app. I think it will be perfect for brainstorming and organizing notes. The home tab also needs to be implemented. Right now, there’s just placeholder text. Still figuring out exactly what I want with it 🤔 #dev #Swift #AppKit
2025-10-31 17:36:08 from 1 relay(s) View Thread →