Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a WKWebView version to replace UIWebView when running under iOS 8... #120

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

richardgroves
Copy link

....

Adds the WebKit framework to the Demo project, and to the podspec file

This is a first pass and no doubt needs review, especially to see if the multiple if (wkWebView) ... else ... patterns can be cleaned up.

…S 8.

Adds the WebKit framework to the Demo project, and to the podspec file
@alexruperez
Copy link
Contributor

👍

@almostintuitive
Copy link

It would be nice to have this available:).

@edwardmp
Copy link

I recommend merging this in, the Javascript engine in WKWebView is the same as in Safari and the one in UIWebView crashes a lot due to this older Javascript engine.

I've forked this fork to add some stuff related to setting the title of the view (#139)

@richardgroves
Copy link
Author

Not it makes much sense anymore with SFSafariViewController out there now in iOS9. I'm switching to use that instead: [weak link with the Safari services framework if still supporting iOS < 9]

#import <SafariServices/SafariServices.h>


// Launch a web link held in NSString* 'link' variable - 
UIViewController* vc = <some view controller to present the web view>

    Class klass = NSClassFromString(@"SFSafariViewController");
    if (klass)
    {
        // class exists
        SFSafariViewController* sv = [[klass alloc] initWithURL:[NSURL URLWithString:link]];
        sv.delegate = self;
        [vc presentViewController:sv animated:YES completion:nil];
    }
    else
    {
        SVModalWebViewController* sv = [[SVModalWebViewController alloc] initWithAddress:link];
        [vc presentViewController:sv animated:YES completion:nil];
    }

and a delegate handler to dismiss it when 'Done' is pressed:

#pragma mark SFSafariViewControllerDelegate
- (void)safariViewControllerDidFinish:(SFSafariViewController *)controller
{
    [controller dismissViewControllerAnimated:YES completion:nil];
}

@edwardmp
Copy link

@richardgroves for my own app I integrated SFSafariViewController but I faced a couple of issues. I wanted to put a navbar on top. This was possible but you still see the URL bar. By using offsets I was able to hide the URL bar but it was very hacky. Also I can't set my own user agent. Therefore I will still need a UIWebView or a WKWebView. The latter is almost like a SFSafariViewController but allows for more customization. Thus this framework is still very useful.

@richardgroves
Copy link
Author

@edwardmp Fair enough - if you are making noticeable add-ons/modifications to things then having the full source control of this library is great, but for just having an in-app browser the SFSafariViewController is easier. Choice is good!

@edwardmp
Copy link

edwardmp commented Nov 6, 2015

Please merge this in 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants