JavaScriptCore is a built-in iOS library that enables you to use JavaScript in apps alongside Objective-C and Swift. It lets developers read JavaScript from a string, execute it from Objective-C or Swift, and share data structures and functions across languages. We JavaScriptCore to share code between Web and iOS.

Sharing code helped us produce a high-quality, consistent experience across devices while iterating rapidly.

This post is about why we chose to use JavaScriptCore and what we learned. The biggest challenges to using JavaScriptCore in a production app were performance optimization for older devices and getting the build process right. Luckily, these problems have simple solutions that just weren't documented.

Why did we use JavaScriptCore?

A killer feature of one of our apps is search that is optimized for finding guests by name. Our goals included:

import os
import shutil
import yaml
#import json
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
from sklearn.externals import joblib
View execute.js
#!/usr/bin/env node
function execute(command) {
const exec = require('child_process').exec
exec(command, (err, stdout, stderr) => {
View BES Button
<div class="pageTitle">
<h2>Agriculture and Allied Sectors</h2>
<div class="btnArea"><a href="#" class="btn btn-primary"><i class="fa fa-angle-left" aria-hidden="true"></i> Back </a></div>
Button Changes Start for web
.pageTitle .btnArea .btn-primary { padding: 10px 15px !important; font-size: 16px; }
View app.rb
require 'sinatra'
require 'mongoid'
require 'json'
require "sinatra/reloader" if development?
class Price
include Mongoid::Document
View gist
sudo curl -L$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
View JS Algo - Reverse String - Reduce helper
function reverseString(string) {
return string.split('').reduce((reversed, character) => character + reversed, '');
View bash
export PATH=${PATH}:/Users/jxiong1/Dropbox/bin
alias bb='rsync -azPq --filter=":- .gitignore" --exclude=.git /Users/jxiong1/Documents /Users/jxiong1/Dropbox/Archives'
alias ee='docker run --rm -v $PWD:/scripts -v $PWD/config:/root/.config/earthengine eescript'
alias py='docker run --rm -p 443:443 -v /Users/jxiong1/Dropbox/py:/root/nb nbgallery/jupyter-alpine'
alias gc='git add . && git commit -m'
alias gl='git log --pretty=oneline | head'
alias rr='Rscript'
View gist:4dff9b6d007dbbbd4a26ee56d12b52bc
@font-face {
font-family: SegoeUI;
local("Segoe UI Light"),
url(// format("woff2"),
url(// format("woff"),
url(// format("truetype");
font-weight: 100;
git clone . && docker-compose up
docker run -it --rm -p 9000:9000 -e ZK_HOSTS="" -e APPLICATION_SECRET=letmein sheepkiller/kafka-manager