Skip to content

Instantly share code, notes, and snippets.

@probablycorey
Created April 20, 2011 22:12
Show Gist options
  • Save probablycorey/933101 to your computer and use it in GitHub Desktop.
Save probablycorey/933101 to your computer and use it in GitHub Desktop.
(scrn#1) Create a new Window-based application.
(scrn#2) Name it WaxApplication, set the device to iPhone, click next, and save it to your Desktop
Open the folder containing the newly created XCode project.
(scrn#3) Make 3 new folders: wax, scripts.
Download latest copy of Wax: https://github.com/probablycorey/wax/zipball/master
Unzip by opening the .zip file.
Navigate to the new folder. It will be called something like "probablycorey-wax-124ca46"
(scrn#4) Your screen should look like this
Copy the lib and the bin folder and paste them in the wax folder located in your WaxApplication project folder.
Copy xcode-template/Classes/ProtocolLoader.h to the WaxApplication project folder.
Copy the xcode-template/scripts/ folder and place it in your WaxApplication project folder.
(scrn#7) Open the wax/lib/extensions/ folder in your WaxApplication project folder. Delete the SQLite & xml folder pictured.
(scrn#5) Your screen should look like this
Go back to the WaxApplication Xcode project.
Select ProtocolLoader.h, scripts and wax in Finder and drag them into the Xcode project. Drop them right underneath the bar that says "Wax Application" and "1 target, iOS SDK X.X".
Uncheck the "Copy items into destination group's folder (if needed)".
Click finish.
Click the bar that says "Wax Application" and "1 target, iOS SDK 4.3".
In the righthand pane click "WaxApplication" under Targets.
Click the "Build Phases" tab.
Click "Copy Bundle Resources" and remove all the lua files.
In the lower right corner click "Add Build Phase" then "Add Run Script"
Set Shell to /bin/zsh
Set the text area below Shell to ""$PROJECT_DIR/wax/lib/build-scripts/copy-scripts.sh""
(scrn#8) Your screen should look like this.
In the left hand pane, open the WaxApplication folder.
Then open the "Supporting Files" folder.
Then open main.m
Set the contents to: "
// This where the magic happens!
// Wax doesn't use nibs to load the main view, everything is done within the
// AppDelegate.lua file
#import <UIKit/UIKit.h>
#import "wax.h"
#import "wax_http.h"
#import "wax_json.h"
#import "wax_filesystem.h"
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
wax_start("AppDelegate.lua", luaopen_wax_http, luaopen_wax_json, luaopen_wax_filesystem, nil);
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
[pool release];
return retVal;
}
"
Delete the MainWindow.xib, WaxApplicationAppDelegate.h and WaxApplicationAppDelegate.m files.
In WaxApplication/Supporting Files/WaxPallication-Info.plist delete the line "Main nib file base name"
Click Run.
If the application launches, you have done these steps correctly!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment