replete-repl / replete-ios

ClojureScript REPL iOS app
Eclipse Public License 1.0
395 stars 25 forks source link

Working "open in" functionality #35

Closed bsvingen closed 9 years ago

bsvingen commented 9 years ago

"Open in" from other apps now seems to be working.

I have tested with Dropbox and Lisping.

I do not yet ask for confirmation from the user before loading.

Handling "open in" when the app is not already running is tricky, since we have to wait for the JavaScript things to be initialized. There is probably a better way of handling this than what I'm doing now. (For some reason the eval output is not shown in this case.)

So a few remaining things to work out, but it should be usable.

screenshot

mfikes commented 9 years ago

Thanks! I'll give it a try.

Maybe no confirmation dialog is even needed in the end? I suppose that's one of those things where you need to try it out a bit to get a feel for whether it is needed.

Yeah, with respect to app initialization, currently the high-level strategy is to initialize the JS environment on a separate thread, and then once done, an initialized flag is set to true. This is done in the (only)( view... it could perhaps be moved to the AppDelegate if that makes loading in files easier. Anyway, I'll see what you have now.

Also, rudimentary ns support is in there, so an ns form won't cause things to balk.

mfikes commented 9 years ago

Turns out an ns inside of do doesn't work the same in ClojureScript as it does in Clojure. Was chatting a bit with Nolen in IRC about this—still reading code to understand the behavior better.

bsvingen commented 9 years ago

Could we change read-eval-print to use read instead of read-string, and then just iterate on a push-back reader until the end of the string? Then it should also work if you type multiple expressions in the eval field.

mfikes commented 9 years ago

Yeah, that sounds like a reasonable idea. If you want to give it a shot, feel free. :)