I have a decision to make about how I will store the note documents in my app.
The native Swift app stores the blocks in a flat JSON structure. This worked fine in the native macOS app, but now that I have also begun building the web app version in Electron, I have some issues because editors like TipTap and Lexical use their own structure, which is AST. That’s very different from my flat JSON structure. I’m probably just gonna switch over to the Lexical-way of doing it instead of my own.
Bit annoying having to do that whole refactor now…
Frederik Handberg
npub1nj0c...2gqz
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...
I love apps with an infinite canvas! #inspiration
Here’s another one:
Trying to build your own Markdown parser is a horrible experience 😂 I tried once and quickly learned that there are just way too many edge cases to solve…
This app is quite similar to the notes app I’m working on.
Looks really good!
Some more UI #inspiration from Threads:
Some UI #inspiration I found on Threads:
I am mostly done implementing support for all the canvas objects in the Electron app. So I’m moving on to note documents now because the last object I need to support in the canvas is the note docs.
I have just gotten Lexical to work in the editor. The experience is very different than my native Swift app.
This is because the native Swift app uses a separate text view for each block whereas all blocks are just one continuous text view in Lexical which is much better for performance.
I have not yet implemented support for images and videos. Only text with formatting is working like paragraphs and headings. #dev
Lexical
I'm trying Electron for the first time.
For the past many months, I have been working on a notes app for macOS. I decided to build this app using native tools for macOS, which is the Swift programming language with SwiftUI and AppKit.
In the future, I want the app to be made for multiple platforms as I personally use different devices running different operating systems. Building a native app makes this problematic as I then need to build a completely new app for each platform. That's going to take a massive amount of time as a single developer, even with AI to help... For example, for iOS I would need UIKit, for Android it would be Kotlin with JetPack, for Windows it would probably be a C# framework, and for Linux it would most likely be some C or C++ framework.
Electron would immediately work for Windows, Linux, and macOS.
My reason for choosing the native route was just to experiment and learn, and I'm happy I made that decision. I have learned a lot.
Regarding SwiftUI and AppKit, I have found the developer experience to be somewhat disappointing. The documentation has not always been the best and online resources are quite limited. Performance has also been a problem with SwiftUI and same with customizability. When implementing a new feature, I usually started out in SwiftUI and then I learned that what I wanted to build wasn't possible in SwiftUI, so I ended up having to use AppKit anyways.
And don't even get me started on AppKit. It's old. Very old. And you can easily feel that.
I find that features take a long time to get perfect with AppKit. I usually have some bugs that I end up spending way too much time trying to solve.
It also was not uncommon for me that I had to use some "low-level" APIs from AppKit. This is where it got really difficult, because as already stated, the official documentation isn't always very informative.
**Let me explain my native macOS dev experience with a bug that I experienced:**
Try to insert an `NSTextView` and then place a SwiftUI view above it.
Then try to change the `NSCursor` to arrow when hovering the SwiftUI view. You will notice that the cursor is NOT the arrow, but instead `iBeam`. This is because `NSTextView` is super aggressive with overriding the cursor no matter whatever you do. You wouldn't believe the amount of time I have spent trying to solve this bug and others alike...
This has been my experience with AppKit and SwiftUI. I feel like I have spent more time solving bugs than implementing features - that's an exaggeration, but still, you get the point :)
This sort of stuff just works by default in Chromium. Instead of solving stupid bugs, you get to actually implement features.
It's now possible to search in canvas files 🎉
I added a new search feature to my notes app for macOS.
When I click `Enter` it will select the next result in the list and `Shift+Enter` will select the previous result. The problem is that the list does not scroll up and down to always keep the selected result visible. That's the last thing to fix and then canvas search should be working fully as expected.
#dev #Swift #SwiftUI #AppKit #macOS
Maya loves water 😂 #dog #nature
In my notes app, I have overused notifications to pass data around my application.
More specifically I used `NotificationCenter`.
Using a notification-based system is certainly a very fast and easy way to pass data around, but it’s quite difficult to debug.
This is the reason why I’m refactoring parts of the code to be using a state-driven approach in my ViewModels.
I’m building the app that I haven’t been able to find: a beautiful and native notes app for macOS that is perfect for writing note documents and creating mood boards in an infinite canvas.
As a software developer, I need the functionality to create and edit Markdown files to write the features my applications need. I include implementation details for the features I’m building that I can then use to prompt LLMs with.
I also do a lot of frontend work, so I’m often looking for inspiration.
I think that an infinite canvas would be perfect for this, where I’m able to import images and videos of interesting UI designs that I find on socials.
I also started a new hobby: fashion design.
In the screenshot of the app, I imported some images and videos into the canvas of some garments that I find cool.
#dev #Swift #SwiftUI #AppKit #macOS
As a software developer, I need the functionality to create and edit Markdown files to write the features my applications need. I include implementation details for the features I’m building that I can then use to prompt LLMs with.
I also do a lot of frontend work, so I’m often looking for inspiration.
I think that an infinite canvas would be perfect for this, where I’m able to import images and videos of interesting UI designs that I find on socials.
I also started a new hobby: fashion design.
In the screenshot of the app, I imported some images and videos into the canvas of some garments that I find cool.
#dev #Swift #SwiftUI #AppKit #macOSLink previews and interactive website objects are now fully implemented in the notes app. #dev
I ended up changing the website objects so that by default they use snapshot images when they aren't focused. Then once the user focuses a web object, it changes from snapshot to a `WKWebView`, so that the user can interact with the website.
When unfocusing, the object will then convert back to a snapshot again. However, the app will take a new snapshot before the conversion from webview to make sure it's up to date.
I ended up changing the website objects so that by default they use snapshot images when they aren't focused. Then once the user focuses a web object, it changes from snapshot to a `WKWebView`, so that the user can interact with the website.
When unfocusing, the object will then convert back to a snapshot again. However, the app will take a new snapshot before the conversion from webview to make sure it's up to date.Been working on implementing undo/redo functionality in my notes app.
The `UndoManager` API makes this easy by simply calling `registerUndo` and then you can use `setActionName` to give it a name that will be displayed in the 'Undo' menu option located in 'Edit'.


Apple Developer Documentation
UndoManager | Apple Developer Documentation
A general-purpose recorder of operations that enables undo and redo.
I will begin #sewing the next t-shirt.
The latest one I made was almost perfect. The shoulder seams should’ve been a bit longer, so I increased that by 2 cm on both sides.
When I have made the perfect t-shirt that fit me, I can move on to the next project. This will most likely be a sweatshirt. I’m already working on the pattern in #CLO3D.


Been working on copy-paste functionality for my notes app. It may sound a bit strange as you might expect this to just work by default, but because of the way I handle text editing in the app, it does not work out of the box.
My notes app is block-based and because of this, each text block is its own text view. This means, a note document includes multiple `NSTextView`s (one for each text block). This makes copy-pasting from multiple blocks quite complicated as these text blocks are completely separate - they have no connection to each other.
This is where my ‘sequential text view’ hack comes into play. I figured out a way to connect separate `NSTextView`s to allow performing text selections across multiple text views, and then I override the default `copy()` function with custom logic to stitch these text blocks together while keeping the text styling/formatting.
So far, copy-pasting works for text, heading, and list blocks. Tomorrow, I will make it work for table, quote, and code blocks.