Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
jacobx
searching Neon…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
1.
▲
by
jacobx
1y ago
Hi HN! We're back with another post describing more detail about how we built Bitrig's interpreter for Swift in Swift, this time going into how we're converting the code into bytecode.
2.
▲
Bitrig's Swift Interpreter: From Code to Bytecode
(bitrig.app)
4 points
by
jacobx
1y ago
|
1 comments
3.
▲
by
jacobx
1y ago
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.
4.
▲
by
jacobx
1y ago
We have a Mac app that we're beta testing with our existing subscribers. Is there a reason you want this on iPad instead of the Mac?
5.
▲
by
jacobx
1y ago
Yeah there was definitely some back and forth about it before we were eventually approved. 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 instea
6.
▲
by
jacobx
1y ago
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) i
7.
▲
by
jacobx
1y ago
I refer to Swift as a "compiled language" because no officially provided interpreter exists for it. Bitrig runs Swift apps which are dynamically generated by an LLM on the iPhone, despite the iPhone strict security provisions (e.g
8.
▲
by
jacobx
1y ago
That's not really been something we'd been considering, but yeah I think we probably could. We're primarily using the interpreter to render SwiftUI views, but it supports running arbitrary Swift expressions or statements.
9.
▲
by
jacobx
1y ago
I just pushed a change that should fix scrolling on Android browsers.
10.
▲
by
jacobx
1y ago
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
11.
▲
by
jacobx
1y ago
Thanks for letting us know! We're investigating now.
12.
▲
by
jacobx
1y ago
Thanks! Yes, it works just as well with UIKit. Fortunately Xcode can synthesize a .swiftinterface for Obj-C frameworks bridged into Swift, so we use that to generate a compiled interface for UIKit (and other Obj-C frameworks).
13.
▲
by
jacobx
1y ago
Hi HN! Since we launched Bitrig ( https://news.ycombinator.com/item?id=45041185 ), we've gotten questions about how it's able to run dynamically generated Swift code. I wrote up this post to answer that. Let me know
14.
▲
How we built an interpreter for Swift
(bitrig.app)
82 points
by
jacobx
1y ago
|
36 comments
15.
▲
by
jacobx
1y ago
Thanks! Sure, feel free to email us: contact at our domain name.
16.
▲
by
jacobx
1y ago
Yes, we think that could be a really cool way to allow mocking up changes to parts of an app, especially for non-technical members of the team. We're not set up for that yet, but it's on our roadmap.
17.
▲
by
jacobx
1y ago
Thanks, we'll have to update the Contact Us link to work more generically. The Send Feedback link is when you're inside of a project, and you tap the ... in a circle button. It uploads your feedback and code directly to us, so is
18.
▲
by
jacobx
1y ago
Per month
19.
▲
by
jacobx
1y ago
Yeah this is an area we want to make a lot better. What we're currently thinking is giving the model a way to more explicitly call out that it is adding a call to something that needs an API key, which would add something to the UI to
20.
▲
by
jacobx
1y ago
I think that’s a pretty good list. The main one I would add is “creators will want to make native Swift apps to have a better user experience”
21.
▲
by
jacobx
1y ago
Yeah that’s been my experience too. You can edit the Swift code directly in bitrig, though editing code on a phone is not the best experience. We’ve had a lot of requests for a Mac app. Stay tuned ;) You can get a compiled build of your app
22.
▲
by
jacobx
1y ago
There’s still a lot to do to make this work really great for the Swift ecosystem, and that’s where we have the most expertise, so that’s what we’ll be focused on for now. That said, we think this same approach could work really well on Andr
23.
▲
by
jacobx
1y ago
Yeah we’d love to find a way to give away more in the free tier for hobbyist users and subsidize that with other things. The idea of us putting an ad in unpaid apps as another option is interesting.
24.
▲
by
jacobx
1y ago
We’ve gotten a lot of requests for WebKit, so we’ll try to add it soon. 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
25.
▲
by
jacobx
1y ago
Yeah there’s a Send Feedback button when you’re in a project that sends feedback along with the code for that project. We also have a discord here: https://discord.com/invite/C7ndWKKq2S
26.
▲
by
jacobx
1y ago
Thanks for trying, sorry you hit that issue! 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 scree
27.
▲
by
jacobx
1y ago
Thanks for letting us know, we'll get this fixed in other browsers (we've been just looking at it in Safari).
28.
▲
by
jacobx
1y ago
Totally agree, we have a lot of ideas for how to make the experience better.
29.
▲
by
jacobx
1y ago
We probably need to make this more discoverable, but if you keep swiping down on the prompt area, you can swipe it completely off screen and your app will be full screen (with a small movable floating button to exit). I really like the idea
30.
▲
by
jacobx
1y ago
Yeah, I think that whole area of dynamically generating UI is really interesting. And having a Swift interpreter like we're using would unlock doing that with native UI components. Our background is more in making developer tools, so b
More ›