Skip to content

Commit a853d35

Browse files
committed
Initial commit
0 parents  commit a853d35

27 files changed

+1506
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
iphone/build

LICENSE

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2015-2016 Hans Knoechel, Michael Gangolf
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

README.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Ti.WKWebView
2+
3+
Summary
4+
---------------
5+
Ti.WKWebView is an open source project to support the `WKWebView` component with Titanium
6+
7+
Requirements
8+
---------------
9+
- Titanium Mobile SDK 6.0.0.GA or later
10+
- iOS 9 or later
11+
- Xcode 8.0 or later
12+
13+
Download + Setup
14+
---------------
15+
16+
### Download
17+
* [Stable release](https://github.com/hansemannn/ti.wkwebview/releases)
18+
* Install from gitTio <a href="http://gitt.io/component/ti.wkwebview" target="_blank"><img src="http://gitt.io/[email protected]" width="120" height="18" alt="Available on gitTio" /></a>
19+
20+
### Setup
21+
Unpack the module and place it inside the `modules/iphone` folder of your project.
22+
Edit the modules section of your `tiapp.xml` file to include this module:
23+
```xml
24+
<modules>
25+
<module>ti.wkwebview</module>
26+
</modules>
27+
```
28+
29+
Features
30+
--------------------------------
31+
TBA
32+
33+
Author
34+
---------------
35+
- Hans Knoechel ([@hansemannnn](https://twitter.com/hansemannnn) / [Web](http://hans-knoechel.de))
36+
37+
License
38+
---------------
39+
Apache 2.0
40+
41+
Contributing
42+
---------------
43+
Code contributions are greatly appreciated, please submit a new [pull request](https://github.com/hansemannn/ti.wkwebview/pull/new/master)!

assets/README

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Place your assets like PNG files in this directory and they will be packaged
2+
with your module.
3+
4+
All JavaScript files in the assets directory are IGNORED except if you create a
5+
file named "ti.wkwebview.js" in this directory in which case it will be
6+
wrapped by native code, compiled, and used as your module. This allows you to
7+
run pure JavaScript modules that are pre-compiled.
8+
9+
Note: Mobile Web does not support this assets directory.

example/app.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var win = Ti.UI.createWindow({
2+
backgroundColor: '#fff'
3+
});
4+
5+
var WK = require('ti.wkwebview');
6+
7+
var webView = WK.createWebView({
8+
url: 'http://appcelerator.com'
9+
});
10+
11+
win.add(webView);
12+
win.open();

iphone/Classes/TiWkwebviewModule.h

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* ti.wkwebview
3+
*
4+
* Created by Hans Knoechel
5+
* Copyright (c) 2016 Your Company. All rights reserved.
6+
*/
7+
8+
#import "TiModule.h"
9+
10+
@interface TiWkwebviewModule : TiModule
11+
{
12+
}
13+
14+
@end

iphone/Classes/TiWkwebviewModule.m

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* ti.wkwebview
3+
*
4+
* Created by Hans Knoechel
5+
* Copyright (c) 2016 Your Company. All rights reserved.
6+
*/
7+
8+
#import "TiWkwebviewModule.h"
9+
#import "TiBase.h"
10+
#import "TiHost.h"
11+
#import "TiUtils.h"
12+
13+
@implementation TiWkwebviewModule
14+
15+
#pragma mark Internal
16+
17+
// this is generated for your module, please do not change it
18+
-(id)moduleGUID
19+
{
20+
return @"b63a2be9-04e3-4bb2-82ec-7c00978de132";
21+
}
22+
23+
// this is generated for your module, please do not change it
24+
-(NSString*)moduleId
25+
{
26+
return @"ti.wkwebview";
27+
}
28+
29+
MAKE_SYSTEM_PROP(CREDENTIAL_PERSISTENCE_NONE, NSURLCredentialPersistenceNone);
30+
MAKE_SYSTEM_PROP(CREDENTIAL_PERSISTENCE_FOR_SESSION, NSURLCredentialPersistenceForSession);
31+
MAKE_SYSTEM_PROP(CREDENTIAL_PERSISTENCE_PERMANENT, NSURLCredentialPersistencePermanent);
32+
MAKE_SYSTEM_PROP(CREDENTIAL_PERSISTENCE_SYNCHRONIZABLE, NSURLCredentialPersistenceSynchronizable);
33+
34+
@end
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* This is a generated file. Do not edit or your changes will be lost
3+
*/
4+
5+
@interface TiWkwebviewModuleAssets : NSObject
6+
{
7+
}
8+
- (NSData*) moduleAsset;
9+
- (NSData*) resolveModuleAsset:(NSString*)path;
10+
11+
@end
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* This is a generated file. Do not edit or your changes will be lost
3+
*/
4+
#import "TiWkwebviewModuleAssets.h"
5+
6+
extern NSData* filterDataInRange(NSData* thedata, NSRange range);
7+
8+
@implementation TiWkwebviewModuleAssets
9+
10+
- (NSData*) moduleAsset
11+
{
12+
13+
14+
return nil;
15+
}
16+
17+
- (NSData*) resolveModuleAsset:(NSString*)path
18+
{
19+
20+
21+
return nil;
22+
}
23+
24+
@end

iphone/Classes/TiWkwebviewWebView.h

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* Appcelerator Titanium Mobile
3+
* Copyright (c) 2009-2016 by Appcelerator, Inc. All Rights Reserved.
4+
* Licensed under the terms of the Apache Public License
5+
* Please see the LICENSE included with this distribution for details.
6+
*/
7+
#import "TiUIView.h"
8+
#import "TiDimension.h"
9+
#import <WebKit/WebKit.h>
10+
11+
@interface TiWkwebviewWebView : TiUIView <WKUIDelegate, WKNavigationDelegate, WKScriptMessageHandler> {
12+
WKWebView *_webView;
13+
14+
TiDimension width;
15+
TiDimension height;
16+
CGFloat autoHeight;
17+
CGFloat autoWidth;
18+
}
19+
20+
- (WKWebView *) webView;
21+
- (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script withCompletionHandler:(void (^)(NSString *result, NSError *error))completionHandler;
22+
23+
@end

0 commit comments

Comments
 (0)