That's cool!

What I haven't been able to figure out is if we actually get FTL with 
JavaScriptCore on iOS 8, or better yet, if we can somehow gain access to a 
JSContext from the WKWebView.

More detail: I'm using ClojureScript to develop what are otherwise native 
iOS apps. (Meaning using UIKit, StoryBoards, UIButtons, UITextFields, view 
hierarchies, animations, etc.—the same stuff you would work with if you sat 
down at Xcode and wrote a "conventional" iOS app.) In other words, not 
self-contained web apps that manipulate the DOM of a page hosted in the app 
in order to render its UI (in which case WKWebView would be directly 
applicable and FTL would be enabled).

You can do this using JavaScriptCore, which is akin to a "bare-bones" 
JavaScript engine that you can use to drive Objective-C objects that you've 
exported into JavaScriptCore, and vice-versa (drive the JavaScript from 
Objective-C). UIWebView, on the other hand, adds additional stuff to its 
JavaScript environment. You can certainly run the output of the 
ClojureScript compiler in JavaScriptCore, but the first thing you will run 
into is the lack console.log, which is easy to add back in via Objective-C. 
Then the next thing you might encounter is the lack of setTimeout (which 
occurs, for example if you use a core.async timeout channel)—which you can 
also add back in. Then, if you try to establish a REPL into JavaScriptCore, 
then you may find you are lacking socket.io, which you could also 
theoretically add to JavaScriptCore.

At that point (essentially trying to run a browser REPL inside something 
that is arguably not a browser), I decided to just use UIWebView, simply 
for the purpose of REPL development, grabbing its JSContext (which is the 
same thing you get when you are working with JavaScriptCore), using private 
API. This is cool for development using the REPL, but it is safer to go 
back to JavaScriptCore for actual release builds that must pass review for 
the App Store. 

So, with WKWebView (the JITed replacement for UIWebView), those same 
questions come into play. Can we gain access to the JSContext of a hidden 
WKWebView using public API? (In that case it can be used all of the time, 
both for REPL dev and for release builds). Failing that, is JavaScriptCore 
JITed in iOS 8?

On Wednesday, June 25, 2014 2:23:32 AM UTC-4, Steve Tickle wrote:
>
> In the upcoming IOS8, UIWebView has the same (JITed) performance as the 
> Safari, the distinction has been removed due to using the new inter-app 
> communication mechanism. This allows the remote application 
> (Safari/JavascriptCore/UIWebView) to display a view into another process, 
> thus bypassing the no-executable-pages issue.
>
> So basically... get the IOS8 beta & new XCode beta and play with it...
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to