Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Open
richardgroves wants to merge 1 commit into
TransitApp:master from
NoodlFroot:master
Open

Adding a WKWebView version to replace UIWebView when running under iOS 8... #120
richardgroves wants to merge 1 commit into
TransitApp:master from
NoodlFroot:master

Conversation

@richardgroves

@richardgroves richardgroves commented Jan 21, 2015

Copy link
Copy Markdown

....

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

Copy link
Copy Markdown
Contributor

👍

Copy link
Copy Markdown

It would be nice to have this available:).

Copy link
Copy Markdown

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)

Copy link
Copy Markdown
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];
}

Copy link
Copy Markdown

@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.

Copy link
Copy Markdown
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 commented Nov 6, 2015

Copy link
Copy Markdown

Please merge this in 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /