Skip to content

Commit 8486e00

Browse files
committed
update README instructions to deal with both iOS and OSX
1 parent 0c529da commit 8486e00

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

README.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
WebViewJavascriptBridge
22
=======================
33

4-
An iOS bridge for sending messages to and from javascript in a UIWebView.
4+
An iOS/OSX bridge for sending messages between Obj-C and JavaScript in UIWebViews/WebViews.
55

6-
If you like WebViewJavascriptBridge you should also check out [WebViewProxy](https://github.com/marcuswestin/WebViewProxy).
6+
If you like WebViewJavascriptBridge you may also want to check out [WebViewProxy](https://github.com/marcuswestin/WebViewProxy).
77

88
In the Wild
99
-----------
10-
WebViewJavascriptBridge is used by a range of companies and projects. This list was just started and is still very incomplete.
10+
WebViewJavascriptBridge is used by a range of companies and projects. This list is incomplete, but feel free to add your's and send a PR.
1111

1212
- [Yardsale](https://www.getyardsale.com/)
1313
- [EverTrue](http://www.evertrue.com/)
@@ -17,27 +17,26 @@ WebViewJavascriptBridge is used by a range of companies and projects. This list
1717
- Flutterby Labs
1818
- JD Media's [鼎盛中华](https://itunes.apple.com/us/app/ding-sheng-zhong-hua/id537273940?mt=8)
1919

20-
Are you using WebViewJavascript at your company? Add it and send us a pull request!
20+
Setup & Examples (iOS & OSX)
21+
----------------------------
2122

22-
Setup & Examples (iOS)
23-
----------------
24-
25-
Just open the Xcode project and hit run to see ExampleApp run.
23+
Start with the Example Apps/ folder. Open either the iOS or OSX project and hit run to see it in action.
2624

2725
To use a WebViewJavascriptBridge in your own project:
2826

29-
1) Drag the `WebViewJavascriptBridge` folder into your project.
27+
1) Drag the `WebViewJavascriptBridge_iOS` or `WebViewJavascriptBridge_OSX` folder into your project.
3028

3129
- In the dialog that appears, uncheck "Copy items into destination group's folder" and select "Create groups for any folders"
32-
- Delete OSX files.
33-
30+
3431
2) Import the header file:
3532

33+
// for iOS:
3634
#import "WebViewJavascriptBridge_iOS.h"
35+
// for OSX:
36+
#import "WebViewJavascriptBridge_OSX.h"
3737

38-
3) Instantiate a UIWebView and a WebViewJavascriptBridge:
38+
3) Instantiate WebViewJavascriptBridge with a UIWebView (iOS) or WebView (OSX):
3939

40-
UIWebView* webView = [[UIWebView alloc] initWithFrame:self.window.bounds];
4140
WebViewJavascriptBridge* bridge = [WebViewJavascriptBridge bridgeForWebView:webView handler:^(id data, WVJBResponseCallback responseCallback) {
4241
NSLog(@"Received message from javascript: %@", data);
4342
responseCallback(@"Right back atcha");
@@ -72,14 +71,14 @@ API Reference
7271

7372
### ObjC API
7473

75-
##### `[WebViewJavascriptBridge bridgeForWebView:(UIWebView*)webview handler:(WVJBHandler)handler]`
76-
##### `[WebViewJavascriptBridge bridgeForWebView:(UIWebView*)webview webViewDelegate:(UIWebViewDelegate*)webViewDelegate handler:(WVJBHandler)handler]`
74+
##### `[WebViewJavascriptBridge bridgeForWebView:(UIWebView/WebView*)webview handler:(WVJBHandler)handler]`
75+
##### `[WebViewJavascriptBridge bridgeForWebView:(UIWebView/WebView*)webview webViewDelegate:(UIWebViewDelegate*)webViewDelegate handler:(WVJBHandler)handler]`
7776

78-
Create a javascript bridge for the given UIWebView.
77+
Create a javascript bridge for the given web view.
7978

8079
The `WVJBResponseCallback` will not be `nil` if the javascript expects a response.
8180

82-
Optionally, pass in `webViewDelegate:(UIWebViewDelegate*)webViewDelegate` if you need to respond to the [UIWebView's lifecycle events](http://developer.apple.com/library/ios/documentation/uikit/reference/UIWebViewDelegate_Protocol/Reference/Reference.html).
81+
Optionally, pass in `webViewDelegate:(UIWebViewDelegate*)webViewDelegate` if you need to respond to the [web view's lifecycle events](http://developer.apple.com/library/ios/documentation/uikit/reference/UIWebViewDelegate_Protocol/Reference/Reference.html).
8382

8483
Example:
8584

@@ -186,7 +185,7 @@ Example:
186185
iOS4 support (with JSONKit)
187186
---------------------------
188187

189-
*Note*: iOS4 support has not yet been tested in v2.
188+
*Note*: iOS4 support has not yet been tested in v2+.
190189

191190
WebViewJavascriptBridge uses `NSJSONSerialization` by default. If you need iOS 4 support then you can use [JSONKit](https://github.com/johnezang/JSONKit/), and add `USE_JSONKIT` to the preprocessor macros for your project.
192191

0 commit comments

Comments
 (0)