-
Notifications
You must be signed in to change notification settings - Fork 500
Adding a WKWebView version to replace UIWebView when running under iOS 8...#120
Adding a WKWebView version to replace UIWebView when running under iOS 8... #120richardgroves wants to merge 1 commit into
Conversation
...S 8. Adds the WebKit framework to the Demo project, and to the podspec file
alexruperez
commented
Apr 28, 2015
👍
almostintuitive
commented
May 11, 2015
It would be nice to have this available:).
edwardmp
commented
Oct 11, 2015
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
commented
Oct 13, 2015
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
commented
Oct 13, 2015
@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
commented
Oct 13, 2015
@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
commented
Nov 6, 2015
Please merge this in 🙏
....
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.