Skip to content

Commit d258d7b

Browse files
Update README
1 parent 69ecc41 commit d258d7b

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ JavaScriptBridge provides the way to write iOS apps with JavaScript.
88

99
## Usage
1010

11+
```objc
12+
// Retrieve the prepared context
13+
JSContext *context = [JSBScriptingSupport globalContext];
14+
15+
// Add framework support if needed.
16+
// ('Foundation', 'UIKit', 'QuartzCore' enabled by default.)
17+
[context addScriptingSupport:@"MapKit"];
18+
[context addScriptingSupport:@"MessageUI"];
19+
20+
// Evaluate script
21+
[context evaluateScript:
22+
@"var window = UIWindow.new();"
23+
@"window.frame = UIScreen.mainScreen().bounds;"
24+
@"window.backgroundColor = UIColor.whiteColor();"
25+
@"window.makeKeyAndVisible();"
26+
];
27+
```
28+
1129
### Naming conventions
1230

1331
**Class name**

0 commit comments

Comments
 (0)