Live data from Hacker News

NodeSwift: Bridge Node.js and Swift

github.com

1–10 of 26 posts

Re: NodeSwift: Bridge Node.js and Swift

#3

Wait, so you compile a swift executable that’s callable from js? How would one distribute this client side in browser? I’m not smart enough to understand this. I love swift, vapor and node individually, I don’t get it together

Node’s a server-side thing, so I don’t think you’d distribute these in the browser.

Re: NodeSwift: Bridge Node.js and Swift

#4

Wait, so you compile a swift executable that’s callable from js? How would one distribute this client side in browser? I’m not smart enough to understand this. I love swift, vapor and node individually, I don’t get it together

You wouldn't run this in the browser. On the frontend, this would be useful for Electron apps (which run an embedded Chromium for the UI and a local node server for business logic and interfacing with the operating system) on MacOS. On the backend, this might be useful if you have a node-based API and want to share some Swift code between your iOS frontend and node backend.

Re: NodeSwift: Bridge Node.js and Swift

#5

Wait, so you compile a swift executable that’s callable from js? How would one distribute this client side in browser? I’m not smart enough to understand this. I love swift, vapor and node individually, I don’t get it together

It might be possible to compile it to web assembly and then call it in the browser.

Re: NodeSwift: Bridge Node.js and Swift

#7
post #3

Wait, so you compile a swift executable that’s callable from js? How would one distribute this client side in browser? I’m not smart enough to understand this. I love swift, vapor and node individually, I don’t get it together

Node’s a server-side thing, so I don’t think you’d distribute these in the browser.

It's a desktop thing too when working with cli tools or electron, though I've found that for electron I just end up calling other languages via IPC on stdin/out. It might not be as fast as ffi from node, but its certainly leagues easier and clearer.

Re: NodeSwift: Bridge Node.js and Swift

#8
I get paid to write Swift code at the day job, at night I write a lot of node backend code for a side project. I have to say that it's pretty refreshing to jump in and not have the (increasingly) opinionated Swift compiler barking at me for everything I do. Unfortunately Swift has also made me extremely paranoid in JS, where I find that everything I write is checked for null, but I don't think I'd trade the freedom in nodeJS for Swift's type safety. This is super cool though, well done.

Re: NodeSwift: Bridge Node.js and Swift

#9
post #8

I get paid to write Swift code at the day job, at night I write a lot of node backend code for a side project. I have to say that it's pretty refreshing to jump in and not have the (increasingly) opinionated Swift compiler barking at me for everything I do. Unfortunately Swift has also made me extremely paranoid in JS, where I find that everything I write is checked for null, but I don't think I'd trade the freedom i…

[deleted]

Re: NodeSwift: Bridge Node.js and Swift

#10
So, the main use case of this is for writing Electron apps, the biggest benefit of Electron is having cross-platform apps, using swift code in your Electron app that's only work on macOS gonna defeat of propose of an Electron app.
Post reply on HN