-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,72 @@ | ||
# WKCookieWebView | ||
WKWebView with cookie sharing support | ||
|
||
- WKWebView with cookie sharing support | ||
|
||
## Requirements | ||
- iOS 8.0+ | ||
- XCode 8.0+ | ||
- Built with Swift 3 | ||
|
||
## Installation | ||
|
||
#### CocoaPods | ||
WKCookieWebView is available through [CocoaPods](http://cocoapods.org). To install | ||
it, simply add the following line to your Podfile: | ||
|
||
```ruby | ||
pod 'WKCookieWebView' | ||
``` | ||
|
||
#### Carthage | ||
For iOS 8+ projects with [Carthage](https://github.com/Carthage/Carthage) | ||
|
||
``` | ||
github "Kofktu/WKCookieWebView" | ||
``` | ||
|
||
## Usage | ||
|
||
#### navigationDelegate -> wkNavigationDelegate | ||
|
||
- You should use ```wkNavigationDelegate``` instead of ```navigationDelegate```. | ||
- However, the three methods of WKNavigationDelegate must use closure instead of delegate. | ||
|
||
|
||
|
||
```swift | ||
// @available(iOS 8.0, *) | ||
// optional public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Swift.Void) | ||
public var onDecidePolicyForNavigationAction: ((WKWebView, WKNavigationAction, @escaping (WKNavigationActionPolicy) -> Swift.Void) -> Void)? | ||
|
||
// @available(iOS 8.0, *) | ||
// optional public func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Swift.Void) | ||
public var onDecidePolicyForNavigationResponse: ((WKWebView, WKNavigationResponse, @escaping (WKNavigationResponsePolicy) -> Swift.Void) -> Void)? | ||
|
||
// @available(iOS 8.0, *) | ||
// optional public func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void) | ||
public var onDidReceiveChallenge: ((WKWebView, URLAuthenticationChallenge, @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Swift.Void) -> Void)? | ||
``` | ||
|
||
|
||
|
||
#### When HTTPCookieStorage is updated | ||
|
||
```swift | ||
public var onUpdateCookieStorage: ((WKCookieWebView) -> Void)? | ||
``` | ||
|
||
#### If you need to set WKWebViewConfiguration | ||
|
||
```swift | ||
let webView = WKCookieWebView(frame: frame, configurationBlock: { (configuration) in | ||
// customize configuration | ||
}) | ||
``` | ||
|
||
## Authors | ||
|
||
Taeun Kim (kofktu), <[email protected]> | ||
|
||
## License | ||
|
||
WKCookieWebView is available under the ```MIT``` license. See the ```LICENSE``` file for more info. |