This repository contains the CocoaPod which powers the MobileNode (Check out the companion node.js repo here). This framework creates a JavaScript execution context in a native app for iOS (and could potentially also for for OS X, though that hasn't been tested at all).
Until things settle down, I won't be writing a lot of documentation. I do pinky swear, however, to provide useful API docs and guides ASAHP.
MobileNode requires that your native iOS project be using Cocoapods. To create a Cocoapods enabled iOS app project with Xcode, check out their documentation. The short version is this:
- Terminal:
gem install cocoapods
- Terminal:
pod setup
- Create an iOS project through Xcode
- Navigate to the location of the
.xcodeproj
folder Xcode created in the Terminal - Create a file called
Podfile
with the following:
platform :ios, '7.0'
pod 'MobileNode', :git => 'git://github.com/kwhinnery/mobilenode-ios'
- Run
pod install
- Open the Cocoapods-enabled Xcode Workspace (use this from now on):
open *xcworkspace
(You may need to quit Xcode first - Xcode is an a-hole sometimes)
- Install node.js
- Run
npm install -g mobilenode
- create a file
app.js
with the following:alert('hello mobile node!');
- Run
mnode serve app.js
- In your Xcode Workspace, open your iOS app's app delegate (it will be
XXXAppDelegate.m
) - At the top, add
#import "MobileNode.h"
- In
application:didFinishLaunchingWithOptions:
, add the following:[MobileNode developOnHost:@"localhost" port:8080];
- Run your app in the iOS simulator
- High five your co-worker
Now, whenever you change your node.js code, changes will be streamed immediately to the simulator and run in a new JS context - a bit like hitting refresh in the browser.
Lots. Still super crude by any reasonable estimation. Still need:
- Native implementations of core node.js modules
- Define how best for native modules to hook into MobileNode
- Explore options for debugging the JSCore environment
- Create Xcode project templates preconfigured with Podfile and some app types (SpriteKit)
- API docs and guides