JavaScript/Swift Interoperability

I think that it would be helpful to have better interoperability between Swift and JavaScript. There are a lot of useful packages on NPM that don't have equivalents for Swift. It would be helpful if Apple provided easier ways to use NPM packages in a Swift project. Currently, the JavaScriptCore framework is missing many standard things used in many packages, like the fetch API. It would be helpful to be able to run sandboxed JavaScript code inside of a Swift app but allow access to specific domains, folders, etc., using a permissions system similar to Deno.

If you have a suggestion, you should raise it at: https://feedbackassistant.apple.com/

When doing so, I recommend you list the specific APIs you want, and the justification for them. A suggestion that Apple just implement some of the missing APIs won't get very far.

I would like to discuss this general idea with other developers before filing feedback for specific APIs. Are there any other places that I should post this to get more discussion?

Are there any other places that I should post this to get more discussion?

I can think of least two:

  • JavaScriptCore is open source as part of WebKit project, and they have their own community discussions.
  • Likewise, Swift is open source and has Swift Forums.

The best approach kinda depends on who you want to do the work. If you just want Apple to fix something, Feedback Assistant is your best option [1]. But if you want to engage with other developers then things get more nuanced, especially with regards to where the changes land, which is a big factor in what work gets done and who does it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] For more about that process, see Bug Reporting: How and Why?.

And if you do file this in Feedback Assistant, please post your bug number, just for the record.

JavaScript/Swift Interoperability
 
 
Q