Live data from Hacker News

How we built an interpreter for Swift

bitrig.app

31–39 of 39 posts

Re: How we built an interpreter for Swift

#34
post #25
post #24

Very very neat. What's the performance like?

There's definitely a cost: everything is type-erased and there's a lot more indirection than there would be if the code was compiled. But you usually don't hit performance issues because most app code (especially in the UI) is just a thin layer calling into the OS frameworks. The framework code does the heavy lifting and is all compiled. The places you can hit performance issues are things like when the app itself ha…

You could do the same thing CPython does: compile common patterns of code into specialized macro-instructions to reduce the interpreter's penalty.

Re: How we built an interpreter for Swift

#36

This is really cool, will definitely try it out. Does it allow you to move this to your computer later and actually publish the apps? What’s the end goal here?

Yep! You can always export your code to take it to your computer.

We also have functionality in bitrig to build your app and send it to App Store Connect so you can deploy it on TestFlight.

Re: How we built an interpreter for Swift

#37
post #11

Could you use this to support hot module replacement? Replacing a SwiftUI view in a live app without restarting the process?

Yeah you could! The only caveat is that either the whole app, or at least the part of the app showing the view you want to replace, would have to be running via the interpreter. We're very interested in using the interpreter to improve the Swift developer experience in more ways like that.

I bet you could make a ton of money just selling a better dev experience as an xcode add-on to Swift devs without even having the AI component. (But making an app on my phone with AI is unbelievably neat!).

Re: How we built an interpreter for Swift

#39

I thought Apple didn't allow any apps that do any kind of code generation or running of user or downloaded code.

Apple has relaxed the guidelines for developer tools compared to the early days of the App Store. If you look today there are Python IDEs, Jupyter Notebooks, and various other apps that execute user generated code. The key guideline to be mindful of is 2.5.2.
Post reply on HN