The app should be lightweight, since it won't do that much (think fancy note taking for a few specific use cases), but ideally it also would be cross-platform. An Electron app would give me the cross-platform, but it's definitely not lightweight and might even feel sluggish. I know everyone here loves to hate Electron. Right now I am inclined to just write it in Swift and make it only support the Apple ecosystem where it also would fulfill all my personal needs, but miss out on lots of potential monetization (which realistically will never happen if I look at my past side projects). Another option would be Qt which I used to write 20 years ago, but it seems very expensive.
What other options would you look at for building a desktop app in 2022?
No one really cares if your app is an “inefficient” electron app of it solves their problem for them.
Electron may be arguably “heavy on memory” but it certainly isn’t sluggish, just look at VS Code (without poorly written plugins) or Slack, both are amazingly fast.
Also you mention it’s a “note taking” like app, if you need a rich text editor using a web browser based platform allows you to use all the incredible wysiwyg/rich text editor toolkits available.
There will always be the option to rewrite the app in a native platform later if you are successful.
Annother bonus with going the hybrid web/electron route is it very easy to extend to mobile later with something like Capacitor.
The limitation is mainly that the widgets are limited. For example, comctl32.dll hasn't got new widgets since Windows xp. So depending on your needs, it might fit perfectly, or lack some features and that's going to be painful.
The Pascal language will feel outdated. But you don't have to do everything using it. You can, for example, write the non-UI logic in other languages and then glue them using dynamic libraries.
Coming from Swift, it was actually a fun experience. It doesn’t look very native, but neither does electron..
Another nice Rust ui framework is Druid: https://github.com/linebender/druid
on desktop, using it under LGPL is not really an issue, so you don't have to go for commercial (where I'd agree the value proposition isn't there very often sadly)
Pros of JavaFX:
- Easy to start if you are familiar with Java and Maven/Gradle.
- Cross platform by default, I ran my apps on macOS, Linux and Linux on Raspberry PI without any problems (just remember to avoid AnchorLayout).
- Can generate deb packages for Linux and DMG for macOS.
- There is a TestFX project for writing GUI "clicky" tests, library seems to no longer be actively maintained but covers all common cases.
- SceneBuilder, ScenicView tools for rapid GUI development.
Now the cons:
- Java 9 module crap, JavaFX is modularized and mixing modular and non-modular libs (e.g. Guava) is real pain.
- Controls are quite primitive there is a TableView for displaying tabular data but there are no column filters out of the box. There are some projects that provide custom controls but there are quite poor compared to what you would get with C# and WPF/WinForms.
- Poor documentation for less common use-cases.
- A lot of bugs and missing features e.g. tray icon in macOS, there are workarounds that _sometimes_ work but can cause a lot of other troubles (e.g. calling AWT api before JavaFX starts).
To sum up, if you know Java and it's build tools and you app is simple then I recommend checking JavaFX out. If you need a more complex GUI then better keep out from it.
1. Write it in the language and ecosystem that you're familiar with. Speed of iteration is more important than the tech stack or executable size...
2. Focus on delivering a working and useful application, performance and memory footprint might not even matter if no one uses the app...
3. Cross-platform has many drawbacks to consider, by taking on cross-platform you're taking on many OS specific bugs which slows down iteration speed...
4. (not mentioned but) Mobile apps should be an after thought, including iOS/Android in some cross-platform build makes things even more complex and slower...
Edit: It doesn't really seem to be all that great at cross-platform though, at least not without your clients jumping through hoops. So maybe it fails on that criterion.
So you maybe able to write for MacOS for now and build Windows version later, if you validate demand and Swift support on Windows matures.
It is not sexy, but without heavy libraries and enterprise patterns, Java programs are surprisingly small and pretty fast. Development is well supported in all IDEs, any question you could have has a stack overflow answer, and it is, of course, cross platform.
Alternatively download Lazarus and free pascal.
I can echo what others have said - choose a technology that you are proficient with. In my case this was web so I went with Electron which was connecting to a small Python/Flask server running locally.
It worked great and I didn't had major issues with Electron, however my biggest hurdle and where I spent a lot of time (even more time than developing the app!) was publishing it on different stores like Microsoft store or Snapcraft for Linux. You haven't provided a lot of details about how you plan to distribute the app but do not underestimate this effort if you plan to use any of the stores.
Shipping for Snapcraft is very complex as you need to learn a lot of new stuff and in my experience their documentation was not great so there was a lot of trial and error, digging through forums and internet.
For distributing on Windows security plays an important role. Modern Windows is protected with Windows Defender and Smart screen etc. and it's impossible just to build an executable and send it to someone. You have to sign your app with a certificate (which is pricey ranging from 100-500$) a year or ship it through Microsoft Store for a small registration fee which takes time and you have to go through their process. There is a third option of sending your executable/installer to Microsoft so that it can be scanned for viruses etc. but it's cumbersome because it's manual.
I saw someone mentioned Tauri, it looks very promising but it wasn't mature enough for my use case. It might work for your scenario, do check it out.
In general, building and distributing desktop apps in 2022 is a real pain and I completely understand why everyone is moving to web nowadays. :)
Good luck and do reach out if you need any help.
It's more important that you get something to market as fast as possible, even if it's Apple-only.
You can always go cross-platform for a V2 release if it takes off. You can't, however, get back all the time you'll spend learning a new platform before you even get started.
personally i find it very easy to make apps for the JVM in Kotlin. IntelliJ support for Java and Kotlin is the best IDE support for any language ever - creating a project, debugging, running tests, refactoring, etc. are seamless. Gradle packages are usually very good quality (although log4shell did originate there). The JVM is fast and reliable, and IME it’s much easier to track down exceptions than C-based apps or JavaScript. The JVM runs on macOS, Windows, Linux, and Android (though not iOS or web).
The main downsides of the JVM are that “native” or neat-looking UI is a lot harder than Electron, your apps will probably have the distinctive Swing style. Moreover, the JVM itself is not lightweight (I think it’s about 150MB), and you have to either include the JVM in your executable or download it on client machines.
I think your gut feeling is probably right. Unless there is a clear and obvious business requirement I would stick with one platform to start with.
All of the cross platform frameworks are compromised (and always will be). Targeting more platforms will be more work. The result won't be as nice.
Qt is relatively easy to cross-compile for at least linux and windows, and if you're mac-native, it might be easy to build for all three platforms
Works well for creating cross platform GUIs if you can accept the somewhat archaic BASIC dialect it uses.