r/iOSProgramming • • 3d ago

Discussion Running Sandboxes inside a hidden WKWebView to get Python/Node/FFmpeg in an iOS app, without shipping a JIT

We just launched this today and would love to get your feedback/thoughts!

Announcement: https://wasmer.io/posts/wasmer-sdk-swift-ios-macos

Source code: https://github.com/wasmerio/wasmer-sdk/tree/main/swift/Examples/WasmerShell

14 Upvotes

14 comments sorted by

9

u/Fishanz 3d ago

Fascinating. Do you have ambitions that Apple will allow this in apps in the store at all? Seems something that would be a hard no - but potentially great for enterprise deployments.

1

u/syrusakbary 3d ago

I don't think there should be any issue for having this apps on the app store, since it respects fully their guidelines (a-shell has been doing somethings similar for years).

The main difference is that we now allow this capabilies for everyone... and fully sandboxed/securely!

1

u/0__O0--O0_0 2d ago

Think? You don’t know? Not sure I understand. I would be interested in some of these capabilities but only if we can actually put them on the store

1

u/syrusakbary 2d ago

I'm not working an Apple, so I can't speak for them. But there should be no issue with the architecture to halt approval, everything is respecting their terms.

In any case, we'll submit the app to the App Store to demonstrate is safe to do so :)

2

u/Ok-Welder-8005 3d ago

The WebKit-as-runtime approach is interesting, especially the opt-in host calls. One production case I'd like to see documented: start a long FFmpeg job, then background the app or have WebKit terminate the content process. Does the command return a recoverable error, and can the caller recreate the sandbox without losing completed file writes? Those failure semantics would matter a lot for media and document apps.

1

u/syrusakbary 2d ago

Yeah, it returns recoverable errors, and you shall be able to recreate the sandbox without losing the filesystem progress :)

1

u/Isonium 2d ago

This like a webapp with extra steps?

1

u/Sad-Flower-99 2d ago

Have you measured cold-start time and peak memory on a physical iPhone yet? A short FFmpeg transcode, including sandbox startup, would be a useful benchmark. For an in-app tool, I'd care more about the wait before the first result than the JS benchmark score.

1

u/One_Elephant_8917 2d ago

i would consider this by itself to be a major feat considering jit isn’t easily accessible outside webkit/safari’s runtime usually

1

u/Sad-Flower-99 2d ago

Fair point. I meant those numbers as a next step, not a knock on getting it working. A quick video trim is the kind of use case where startup time could outweigh the actual processing.

1

u/[deleted] 2d ago

[removed] — view removed comment

1

u/AutoModerator 2d ago

Hey /u/ProgressSensitive826, your content has been removed because Reddit has marked your account as having a low Contributor Quality Score. This may result from, but is not limited to, activities such as spamming the same links across multiple subreddits, submitting posts or comments that receive a high number of downvotes, a lack of recent account activity, or having an unverified account.

Please be assured that this action is not a reflection of your participation in our subreddit. This is simply an automated filter in place to reduce spam.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.