Skip to content

Commit

Permalink
Fix warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0c committed Apr 1, 2017
1 parent d41d219 commit 29cde1e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
7 changes: 6 additions & 1 deletion Example/M2DWebViewController/M2DViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ - (IBAction)show:(id)sender
else {
url = [NSURL URLWithString:@"https://github.com/0x0c/M2DWebViewController"];
}
M2DWebViewController *viewController = [[M2DWebViewController alloc] initWithURL:url type:M2DWebViewTypeUIKit];
M2DWebViewController *viewController = [[M2DWebViewController alloc] initWithURL:url type:M2DWebViewTypeWebKit];
viewController.delegate = self;
[self.navigationController pushViewController:viewController animated:YES];
}
Expand Down Expand Up @@ -108,6 +108,11 @@ - (BOOL)textFieldShouldReturn:(UITextField *)textField

#pragma mark - M2DWebViewControllerDelegate

- (void)m2d_webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
decisionHandler(WKNavigationActionPolicyAllow);
}

- (void)m2d_webViewDidStartLoad:(UIWebView *)webView
{
NSLog(@"hoge");
Expand Down
2 changes: 1 addition & 1 deletion M2DWebViewController.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Pod::Spec.new do |s|
s.name = "M2DWebViewController"
s.version = "0.2.1"
s.version = "0.2.2"
s.summary = "Simple built-in web view controller."
s.homepage = "https://github.com/0x0c/M2DWebViewController"
s.license = 'MIT'
Expand Down
12 changes: 9 additions & 3 deletions Pod/Classes/M2DWebViewController/M2DWebViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ - (void)setToolbarHidden:(BOOL)toolbarHidden
- (WKWebView * _Nullable)webView:(WKWebView * _Nonnull)webView createWebViewWithConfiguration:(WKWebViewConfiguration * _Nonnull)configuration forNavigationAction:(WKNavigationAction * _Nonnull)navigationAction windowFeatures:(WKWindowFeatures * _Nonnull)windowFeatures
{
if ([self.delegate respondsToSelector:@selector(m2d_webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:)]) {
[self.delegate m2d_webView:webView createWebViewWithConfiguration:configuration forNavigationAction:navigationAction windowFeatures:windowFeatures];
return [self.delegate m2d_webView:webView createWebViewWithConfiguration:configuration forNavigationAction:navigationAction windowFeatures:windowFeatures];
}

return nil;
}

- (void)webViewDidClose:(WKWebView * _Nonnull)webView
Expand Down Expand Up @@ -223,15 +225,19 @@ - (void)webView:(WKWebView * _Nonnull)webView runJavaScriptTextInputPanelWithPro
- (BOOL)webView:(WKWebView * _Nonnull)webView shouldPreviewElement:(WKPreviewElementInfo * _Nonnull)elementInfo
{
if ([self.delegate respondsToSelector:@selector(m2d_webView:shouldPreviewElement:)]) {
[self.delegate m2d_webView:webView shouldPreviewElement:elementInfo];
return [self.delegate m2d_webView:webView shouldPreviewElement:elementInfo];
}

return NO;
}

- (UIViewController * _Nullable)webView:(WKWebView * _Nonnull)webView previewingViewControllerForElement:(WKPreviewElementInfo * _Nonnull)elementInfo defaultActions:(NSArray<id <WKPreviewActionItem>> * _Nonnull)previewActions
{
if ([self.delegate respondsToSelector:@selector(m2d_webView:previewingViewControllerForElement:defaultActions:)]) {
[self.delegate m2d_webView:webView previewingViewControllerForElement:elementInfo defaultActions:previewActions];
return [self.delegate m2d_webView:webView previewingViewControllerForElement:elementInfo defaultActions:previewActions];
}

return nil;
}

- (void)webView:(WKWebView * _Nonnull)webView commitPreviewingViewController:(UIViewController * _Nonnull)previewingViewController
Expand Down

0 comments on commit 29cde1e

Please sign in to comment.