---
title: "GAJavaScript"
url: https://deallocatedobjects.com/posts/gajavascript
author: Jake Marsh
published: 2011-10-26
updated: 2013-11-16
link: https://github.com/newyankeecodeshop/GAJavaScript
topics: ["iOS Development", "Open Source", "Web"]
description: "Been wanting something like this for a long time. GAJavaScript is a Cocoa Touch library that makes working with JavaScript from inside native code much more tolerable, maybe even fun. JavaScript is accessed from Cocoa Touch using UIWebView."
---

# GAJavaScript

By Jake Marsh, October 26, 2011. HTML: https://deallocatedobjects.com/posts/gajavascript

This is a link post about https://github.com/newyankeecodeshop/GAJavaScript

Been wanting something like this for a long time. [`GAJavaScript`](https://github.com/newyankeecodeshop/GAJavaScript) is a Cocoa Touch library that makes working with JavaScript from inside native code much more tolerable, maybe even fun.

> JavaScript is accessed from Cocoa Touch using UIWebView. GAJavaScript has the concept of a "script engine", which provides the primary interface to the JavaScript runtime inside the UIWebView. Essentially, the UIWebView is an implementation detail of this library, but you may want to manage the UIWebView instance used by the script engine.

Some might say it's a nasty hack, but in certain situations I can see this totally coming in handy. I work on a product regularly that needs to facilitate complex communication between remote web view content and local native code, and boy, I really wish I'd known about this library back when I started that project.

[`GAJavaScript`](https://github.com/newyankeecodeshop/GAJavaScript) was built by [Andrew Goodale](http://twitter.com/andrewg95) and if you like it you should definitely take a look at one of his other projects, [`GAViewStyling`](https://github.com/newyankeecodeshop/GAViewStyling) which is a neat little library letting you style `UIView` objects with `CSS` style declarations.
