I'm wondering if it's possible to build apps that work kind of like Matlab or Python's Jupyter notebooks, where you'd have Swift code interleaved with document text and graphics, and small changes to code are executed almost immediately. I imagine this would require an API to the compiler, so that you could replace bits of an AST with minimal propagating changes. Does such an API exist? Maybe it's not feasible in Swift? Those two examples I gave are simpler and more dynamically typed languages.
I don't know how Xcode Playgrounds are implemented. Maybe it uses an API like this, or maybe it builds a file to feed to the standard compiler?