5 ms·
This is an Electron app, but it never opens a web view; it configures the tray using the native menu bar API. Neat. I wish it was this easy to start with Swift
by jitl 3y ago
This is an Electron app, but it never opens a web view; it configures the tray using the native menu bar API. Neat.
I wish it was this easy to start with Swift. The SwiftUI API makes the menu stuff almost this easy, but dealing with Xcode projects and Apple Developer program auth stuff always put me off.
- deleted 3y ago[deleted]
- brailsafe 3y agoI was also surprised it's a TS project. I will say learning Swift and native macos dev during the last year without a job has been quite fun, and a nice departure from web stuff. Swift's type system is very similar to Typescript, and SwiftUI is somewhat similar to any component UI library, but it has it's own interesting bits. Xcode is a beast, but can be a decent IDE after you get familiarized to the quirks of the language and build process.
- josephg 3y agoI find Xcode so unbelievably unstable for a modern set of developer tools. The last time I was using it to build software, it crashed about once a day, and froze or did weird things regularly. I've also had severe typing lag (!!) and phantom build issues where I build something and it fails with some strange linker error or something, but then doing a clean & rebuild mysteriously fixes everything. And SwiftUI seems great on the surface until you spend time with it and try to actually do anything remotely custom. I spent about a week trying to get a swipe gesture able to push the keyboard out of the way (like you see in Apple Notes and most messaging applications). The web is full of half working hacks that throw up warning messages when the app is running. When things don't work its incredibly difficult figure out whats going on. The documentation is atrocious and the debugging tools are absolute rubbish compared to what you'll find in any modern web browser. Coming back to writing typescript in VS Code or writing rust in Intellij felt like a breath of fresh air compared to working in Xcode. Everything works, and it works fast and reliably. I have good documentation and I can read the code I'm calling if I get confused. I really like Swift as a language and I think Apple has a lot of great ideas there, but developing a swiftui app using apple's developer tooling was a miserable experience. Xcode feels like a cobbled together, buggy mess.
- brailsafe 3y agoI think I'd agree with your assessment, and some of those problems are what I was thinking of when I wrote my comment, especially the documentation. > Coming back to writing typescript in VS Code or writing rust in Intellij felt like a breath of fresh air compared to working in Xcode. Everything works, and it works fast and reliably. I have good documentation and I can read the code I'm calling if I get confused. Some of the tools we use are fast because they have less or no baggage, and some aren't because they have tons. In terms of what Xcode tries to accomplish, it fairs better and is capable of more than any tool I can think of, but there's no way it could compete with anything else that has a relatively austere set of requirements. It is indeed a cobbled together buggy mess, but I just don't think you get 20+ years in without a bit of that. IntelliJ is an interesting example in that they have managed to build tools that are both rich with features and somewhat performant, and to your implied point, they probably have to in order to compete; if all Xcode did was compile raw Swift and let you visually debug, it would almost certainly lose that fight. Maybe VSCode or Nova will usurp Xcode, and make the experience of just writing Swift and SwiftUI faster against Foundation, AppKit UIKit, etc.. but then you'll need to still likely run it on some emulator, potentially analyze performance issues, preview layouts visually, maybe run cloud builds, configure CoreData models, blah blah blah. Not all the time, but it's there. Comparatively, other tools just delegate responsibility to other huge projects that haven't always been around or all that great or not great enough. Writing any web code without Chrome or Firefox devtools would suuuuuuck, and ultimately that's usually what I'm doing. Webstorm and VSCode are.. ok at the full package I guess, but not as good as discrete applications. Webpack is also miserably slow and arcane compared to esbuild or vite, but have their own limitations.
- josephg 3y ago> Some of the tools we use are fast because they have less or no baggage, and some aren't because they have tons. In terms of what Xcode tries to accomplish, it fairs better and is capable of more than any tool I can think of, Hard disagree on this. I can't think of any IDE that performs as badly, or is as unreliable as Xcode. Intellij is significantly more complex and its still more responsive. (And its reliably responsive. I've never experienced typing lag in intellij on my M1). Xcode will lag even when I have plenty of cores doing absolutely nothing. As far as I can tell, the xcode UI doesn't seem to be in a separate thread from autocomplete queries. So if there's work happening "in the background" (like looking up function signatures for autocomplete), typing becomes janky. Intellij does seriously well for itself given its written in Java, and it doesn't use native controls. And it handles about 10 different languages. Xcode honestly has every advantage here, but still manages to drop the ball. And if you want to say xcode has been around for longer with more technical debt, well, Microsoft's Visual studio (not vs code) is honestly fabulous compared to xcode. VS is of a similar vintage to xcode, with just as many "cobbled together" features added over the years - from VB to C# and .net, winforms to WPF to whatever the latest thing is. But its still fast and reliable. Well, its fast and an order of magnitude more reliable than xcode. And for the record, its a really bad look when the people writing developer tooling can't develop code very well. I expect better from Apple.
- ustad 3y agoI was going to mention the typescript as well. How does typescript in electron get access to multiple mice hardware and also control multiple cursors? I would have thought that would be near impossible without going native.
- jitl 3y agoLike Python or any other scripting language, via native extensions or FFI to native libraries. node-hid uses native code to control human interface devices. Source code here: https://github.com/node-hid/node-hid/blob/484d13460a89939530eb9e562d5c5f8aa2e56dc5/src/HID.cc https://github.com/node-hid/node-hid/blob/484d13460a89939530...
- ustad 3y agoOh wow thanks for that. I now see the node-hid dependency in the config file.
- deleted 3y ago[deleted]
- hboon 3y agoDo you mean generally run a SwiftUI app without Xcode + signing or running with access to menubars etc? If it's the former, it's possible and very viable too https://www.objc.io/blog/2020/05/19/swiftui-without-an-xcodeproj/ https://www.objc.io/blog/2020/05/19/swiftui-without-an-xcode... I just do something like: `cat base.swift foo.swift | swift -`