51 karma · joined Aug 2, 2021 (5y ago) · 36 submissions
2.
Bitrig's Swift Interpreter: From Code to Bytecode(bitrig.app ↗)
4 points · by jacobx · 1y ago · 1 comment
comment 1y ago · link · parent
In a sense, this isn't very different from what React Native does (run interpreted code that calls out into native code), just with Swift instead of JavaScript. There used to be JavaScript-specific requirements in the guidelines, but that has been loosened since Swift Playgrounds was released. Now there are Python IDEs, Jupyter Notebooks, and other apps running arbitrary code in the App Store.
comment 1y ago · link · parent
The places you can hit performance issues are things like when the app itself has a tight loop that's doing a lot of work.
comment 1y ago · link · parent
Bitrig runs Swift apps which are dynamically generated by an LLM on the iPhone, despite the iPhone strict security provisions (e.g. inability to write executable pages of memory). The way we do this is by parsing the generated Swift code and mapping that to the compiled calls to the libraries that come in the OS. It's pretty weird, but we think it's worth it to get the ability to immediately render the generated code on the phone.
comment 1y ago · link · parent
We're very interested in using the interpreter to improve the Swift developer experience in more ways like that.
comment 1y ago · link · parent
14.
How we built an interpreter for Swift(bitrig.app ↗)
82 points · by jacobx · 1y ago · 36 comments
comment 1y ago · link · parent
I'll take a look at camera access and see what's going wrong there.
comment 1y ago · link · parent
I think there's also work when need to do in the system prompt to guide the model away from all of the placeholder data (or at least so that when it adds it there's a better affordance to transform it to real data).
comment 1y ago · link · parent
You can get a compiled build of your app from bitrig: go to Distribute App which will build your app on our server and then upload it to TestFlight for you (this requires a paid Apple Developer Account). This lets you install the compiled app on your Home Screen. You could also always export the code if you want to build it yourself.
comment 1y ago · link · parent
That said, we think this same approach could work really well on Android, and it’d be interesting to expand there too.
comment 1y ago · link · parent
If we hit issues we can try to pull in just a subset, but one nice thing about Swift is the frameworks have .swiftinterface files which list all the APIs in them, so we’ve generally been able to pull in whole frameworks at a time.
comment 1y ago · link · parent
We also have a discord here: https://discord.com/invite/C7ndWKKq2S
comment 1y ago · link · parent
Could you send us feedback from your project? (Go to the ... menu, then Send Feedback.) If you're not able to use the UI from within your project you can long-press on it from the main screen and choose Recovery Mode, and then enter the project with the interpreter disabled.
comment 1y ago · link · parent
I really like the idea of a platform for people sharing mini-apps! It would be great if people could make lightweight specialized apps for different niches and share them with less friction.
comment 1y ago · link · parent
Our background is more in making developer tools, so bitrig was the first product we were excited about, but I think there's a lot of overlap with dynamic UI generation, and we'd love to explore that too.