Permalink
Browse files

Seed project with an example app and the stub implementation of a Web…

…ViewJavscriptBridge
  • Loading branch information...
0 parents commit 05c076187db2b63f1b256df7828981070ec7478b @marcuswestin committed Aug 27, 2011
11 .gitignore
@@ -0,0 +1,11 @@
+# Mac OS X
+*.DS_Store
+
+# Xcode
+*.pbxuser
+*.mode1v3
+*.mode2v3
+*.perspectivev3
+*.xcuserstate
+project.xcworkspace/
+xcuserdata/
276 WebViewJavascriptBridge.xcodeproj/project.pbxproj
@@ -0,0 +1,276 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 2C1E9EA114099B4600C5C30E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C1E9EA014099B4600C5C30E /* UIKit.framework */; };
+ 2C1E9EA314099B4600C5C30E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2C1E9EA214099B4600C5C30E /* Foundation.framework */; };
+ 2C1E9EA914099B4600C5C30E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2C1E9EA714099B4600C5C30E /* InfoPlist.strings */; };
+ 2C1E9EAB14099B4600C5C30E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C1E9EAA14099B4600C5C30E /* main.m */; };
+ 2C1E9EAF14099B4600C5C30E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C1E9EAE14099B4600C5C30E /* AppDelegate.m */; };
+ 2C1E9EB814099BC900C5C30E /* WebViewJavascriptBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C1E9EB714099BC900C5C30E /* WebViewJavascriptBridge.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 2C1E9E9C14099B4600C5C30E /* WebViewJavascriptBridge.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WebViewJavascriptBridge.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 2C1E9EA014099B4600C5C30E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 2C1E9EA214099B4600C5C30E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 2C1E9EA614099B4600C5C30E /* WebViewJavascriptBridge-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "WebViewJavascriptBridge-Info.plist"; sourceTree = "<group>"; };
+ 2C1E9EA814099B4600C5C30E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 2C1E9EAA14099B4600C5C30E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 2C1E9EAC14099B4600C5C30E /* WebViewJavascriptBridge-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "WebViewJavascriptBridge-Prefix.pch"; sourceTree = "<group>"; };
+ 2C1E9EAD14099B4600C5C30E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 2C1E9EAE14099B4600C5C30E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 2C1E9EB614099BC900C5C30E /* WebViewJavascriptBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebViewJavascriptBridge.h; path = Classes/WebViewJavascriptBridge.h; sourceTree = "<group>"; };
+ 2C1E9EB714099BC900C5C30E /* WebViewJavascriptBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WebViewJavascriptBridge.m; path = Classes/WebViewJavascriptBridge.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 2C1E9E9914099B4600C5C30E /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2C1E9EA114099B4600C5C30E /* UIKit.framework in Frameworks */,
+ 2C1E9EA314099B4600C5C30E /* Foundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 2C1E9E9114099B4600C5C30E = {
+ isa = PBXGroup;
+ children = (
+ 2C1E9EA414099B4600C5C30E /* WebViewJavascriptBridge */,
+ 2C1E9E9F14099B4600C5C30E /* Frameworks */,
+ 2C1E9E9D14099B4600C5C30E /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 2C1E9E9D14099B4600C5C30E /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 2C1E9E9C14099B4600C5C30E /* WebViewJavascriptBridge.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 2C1E9E9F14099B4600C5C30E /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 2C1E9EA014099B4600C5C30E /* UIKit.framework */,
+ 2C1E9EA214099B4600C5C30E /* Foundation.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 2C1E9EA414099B4600C5C30E /* WebViewJavascriptBridge */ = {
+ isa = PBXGroup;
+ children = (
+ 2C1E9EAD14099B4600C5C30E /* AppDelegate.h */,
+ 2C1E9EAE14099B4600C5C30E /* AppDelegate.m */,
+ 2C1E9EB514099B4E00C5C30E /* Classes */,
+ 2C1E9EA514099B4600C5C30E /* Supporting Files */,
+ );
+ path = WebViewJavascriptBridge;
+ sourceTree = "<group>";
+ };
+ 2C1E9EA514099B4600C5C30E /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 2C1E9EA614099B4600C5C30E /* WebViewJavascriptBridge-Info.plist */,
+ 2C1E9EA714099B4600C5C30E /* InfoPlist.strings */,
+ 2C1E9EAA14099B4600C5C30E /* main.m */,
+ 2C1E9EAC14099B4600C5C30E /* WebViewJavascriptBridge-Prefix.pch */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 2C1E9EB514099B4E00C5C30E /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ 2C1E9EB614099BC900C5C30E /* WebViewJavascriptBridge.h */,
+ 2C1E9EB714099BC900C5C30E /* WebViewJavascriptBridge.m */,
+ );
+ name = Classes;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 2C1E9E9B14099B4600C5C30E /* WebViewJavascriptBridge */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 2C1E9EB214099B4600C5C30E /* Build configuration list for PBXNativeTarget "WebViewJavascriptBridge" */;
+ buildPhases = (
+ 2C1E9E9814099B4600C5C30E /* Sources */,
+ 2C1E9E9914099B4600C5C30E /* Frameworks */,
+ 2C1E9E9A14099B4600C5C30E /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = WebViewJavascriptBridge;
+ productName = WebViewJavascriptBridge;
+ productReference = 2C1E9E9C14099B4600C5C30E /* WebViewJavascriptBridge.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 2C1E9E9314099B4600C5C30E /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0420;
+ ORGANIZATIONNAME = Clover;
+ };
+ buildConfigurationList = 2C1E9E9614099B4600C5C30E /* Build configuration list for PBXProject "WebViewJavascriptBridge" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 2C1E9E9114099B4600C5C30E;
+ productRefGroup = 2C1E9E9D14099B4600C5C30E /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 2C1E9E9B14099B4600C5C30E /* WebViewJavascriptBridge */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 2C1E9E9A14099B4600C5C30E /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2C1E9EA914099B4600C5C30E /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 2C1E9E9814099B4600C5C30E /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2C1E9EAB14099B4600C5C30E /* main.m in Sources */,
+ 2C1E9EAF14099B4600C5C30E /* AppDelegate.m in Sources */,
+ 2C1E9EB814099BC900C5C30E /* WebViewJavascriptBridge.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 2C1E9EA714099B4600C5C30E /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 2C1E9EA814099B4600C5C30E /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 2C1E9EB014099B4600C5C30E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 2C1E9EB114099B4600C5C30E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ CLANG_ENABLE_OBJC_ARC = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 2C1E9EB314099B4600C5C30E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "WebViewJavascriptBridge/WebViewJavascriptBridge-Prefix.pch";
+ INFOPLIST_FILE = "WebViewJavascriptBridge/WebViewJavascriptBridge-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ 2C1E9EB414099B4600C5C30E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "WebViewJavascriptBridge/WebViewJavascriptBridge-Prefix.pch";
+ INFOPLIST_FILE = "WebViewJavascriptBridge/WebViewJavascriptBridge-Info.plist";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 2C1E9E9614099B4600C5C30E /* Build configuration list for PBXProject "WebViewJavascriptBridge" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 2C1E9EB014099B4600C5C30E /* Debug */,
+ 2C1E9EB114099B4600C5C30E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 2C1E9EB214099B4600C5C30E /* Build configuration list for PBXNativeTarget "WebViewJavascriptBridge" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 2C1E9EB314099B4600C5C30E /* Debug */,
+ 2C1E9EB414099B4600C5C30E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 2C1E9E9314099B4600C5C30E /* Project object */;
+}
9 WebViewJavascriptBridge/AppDelegate.h
@@ -0,0 +1,9 @@
+#import <UIKit/UIKit.h>
+#import "WebViewJavascriptBridge.h"
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+@property (strong, nonatomic) WebViewJavascriptBridge *javascriptBridge;
+
+@end
62 WebViewJavascriptBridge/AppDelegate.m
@@ -0,0 +1,62 @@
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+@synthesize window = _window;
+@synthesize javascriptBridge;
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ [self.window makeKeyAndVisible];
+
+ UIWebView* webView = [[UIWebView alloc] initWithFrame:self.window.bounds];
+ javascriptBridge = [[WebViewJavascriptBridge alloc] init];
+ webView.delegate = javascriptBridge;
+ [self.window addSubview:webView];
+
+ [webView loadHTMLString:@"<h1 style='margin-top:20px;'>Hello World</h1>" baseURL:nil];
+
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application
+{
+ /*
+ Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+ */
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application
+{
+ /*
+ Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+ */
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application
+{
+ /*
+ Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+ */
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application
+{
+ /*
+ Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+ */
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ /*
+ Called when the application is about to terminate.
+ Save data if appropriate.
+ See also applicationDidEnterBackground:.
+ */
+}
+
+@end
5 WebViewJavascriptBridge/Classes/WebViewJavascriptBridge.h
@@ -0,0 +1,5 @@
+#import <Foundation/Foundation.h>
+
+@interface WebViewJavascriptBridge : NSObject <UIWebViewDelegate>
+
+@end
10 WebViewJavascriptBridge/Classes/WebViewJavascriptBridge.m
@@ -0,0 +1,10 @@
+#import "WebViewJavascriptBridge.h"
+
+@implementation WebViewJavascriptBridge
+
+- (id) init {
+ self = [super init];
+ return self;
+}
+
+@end
43 WebViewJavascriptBridge/WebViewJavascriptBridge-Info.plist
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFiles</key>
+ <array/>
+ <key>CFBundleIdentifier</key>
+ <string>com.marcuswestin.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
14 WebViewJavascriptBridge/WebViewJavascriptBridge-Prefix.pch
@@ -0,0 +1,14 @@
+//
+// Prefix header for all source files of the 'WebViewJavascriptBridge' target in the 'WebViewJavascriptBridge' project
+//
+
+#import <Availability.h>
+
+#ifndef __IPHONE_3_0
+#warning "This project uses features only available in iOS SDK 3.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+#endif
2 WebViewJavascriptBridge/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
18 WebViewJavascriptBridge/main.m
@@ -0,0 +1,18 @@
+//
+// main.m
+// WebViewJavascriptBridge
+//
+// Created by John Marcus Westin on 8/27/11.
+// Copyright (c) 2011 Clover. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "AppDelegate.h"
+
+int main(int argc, char *argv[])
+{
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}

0 comments on commit 05c0761

Please sign in to comment.