Swift Compiler Based App

I'm developing an App for IOs that's basically an IDE. Is there a way to compile and execute written code at runtime?

This is a question you should post on the Apple Developer forums since it has to do with interpreting App Store guidelines and iOS restrictions. There are iOS applications that use interpreted languages like Lua and Python within their sandbox to provide AI rule processing for games, machine learning, etc.. But, native compiling and building applications has not yet made it to iOS platforms, intentionally.

1 Like

Thanks! So you think i should post on the Apple Developer Forums.

There's in fact a specific policy for IDE application. My specific problem is that i want to compile and run Swift code but i've not found a Swift Online Compiler with API neither a way to use the local compailer on iPhone if there's any.

That‘s not what the original question was though. Swift Playgrounds does "seem" to compile and execute code on iOS, but I don‘t know any more details. Asking on the Apple Dev Forums will likely be a dead end. Compiler related things are at home in our forum though.

Yeah but that’s an official Apple app, so the usual restrictions for 3rd-party apps don’t apply.

Not saying it isn’t possible (I don’t know), but you can’t assume that any app can do it because the playgrounds app does.

It's a policy question about whether Apple will allow his application to go through the App Store, not whether an iPad or iPhone that is not jail-broken can run a compiler and build applications outside of an Apple sanctioned environment like Swift playgrounds. The OP wants to compile and execute software on an iPad or an iPhone, not on a Mac to run on an iPad or iPhone. He can write an application like Swift playgrounds which uses the Swift interpreter, just like a game can use Lua or Python to run decision trees, AI software, etc., within its environment. But, up to now, you can't host a full compiler suite on an iPad. If the rumored port of Xcode to the iPad comes about, that will of course change.

Since it's an Apple policy question, not a technical Swift issue, based on the ground rules of this forum, it should be asked in an Apple-specific environment.

Apparently LLVM’s lli interpreter works on iOS.

EDIT: More info, including a link to the GitHib repo.

1 Like

Again, you‘re interpreting too much into the original question. It‘s not about wether or not Apple allows you to publish such app, judging from the OP, the app is not even at a stage to run Swift code like Playgrounds and it‘s about the technical aspect on "how to make that work on a particular platform" not about if you're allowed to do that there yet. IIRC someone asked something similar about LSP, which is the same principle, it‘s a tech / compiler / tooling question that still fits and belongs here, not in the Apple Dev forums.

Unless I‘m mistaken and the app is already ready, only then you‘d need to answer questions like you mentioned, which of course can‘t be answered by anyone other than Apple.

Linking this thread here since it appears there's other interest in getting the swift compiler to work on iOS as well.

Also linking this which appears to be a project using LLVM + clang under the hood to compile C code.