NEW! Pre-order my latest book, Testing Swift! >>

WKWebView

Found 7 articles in the Swift Knowledge Base for this category:

 

How to control the sites a WKWebView can visit using WKNavigationDelegate

By default a WKWebView can navigate to any links the user selects, but it’s common to want to restrict that. It only takes a few simple steps:... Continue Reading >>

How to control the user interface of a WKWebView using WKUIDelegate

By default WKWebView works sort of like Safari, albeit in a single view rather than having tabs. If you want something more advanced – being able to monitor opening and closing windows, override behavior for JavaScript user interface, and so on – then the WKUIDelegate protocol is for you.... Continue Reading >>

How to enable back and forward swiping gestures in WKWebView

One of the many advantages of WKWebView over UIWebView is its ability to draw on some of the native user interface of Safari. It's a long way from the SFSafariViewController that was introduced in iOS 9.0, but you can enable the built-in gestures that let users go back and forward by swiping left and right.... Continue Reading >>

How to load HTTP content in WKWebView and UIWebView

App Transport Security (ATS) normally doesn’t allow our apps to connect to HTTP servers, but there’s a special exception you can add to allow UIWebView and WKWebView to load insecure content.... Continue Reading >>

How to monitor WKWebView page load progress using key-value observing

iOS often uses a delegate system to report important changes, such as when a table view cell has been tapped or when a web page has finished loading. But the delegate system only goes so far, and if you want fine-grained detailed information sometimes you need to turn to KVO, or "key-value observing."... Continue Reading >>

How to run JavaScript on a WKWebView with evaluateJavaScript()

Using evaluateJavaScript() you can run any JavaScript in a WKWebView and read the result in Swift. This can be any JavaScript you want, which effectively means you can dig right into a page and pull out any kind of information you want.... Continue Reading >>

What's the difference between UIWebView and WKWebView?

The UIWebView class has been around since iOS 2.0 as a way to show HTML content inside your app, but iOS 8.0 introduced WKWebView as an alternative - what's the difference?... Continue Reading >>

About the Swift Knowledge Base

This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions, all written for Swift 4.

Build for watchOS

Take your existing Swift skills to Apple's tiniest platform – check out Hacking with watchOS!

MASTER SWIFT NOW
Buy Practical iOS 12 Buy Pro Swift Buy Swift Design Patterns Buy Practical iOS 11 Buy Swift Coding Challenges Buy Server-Side Swift (Vapor Edition) Buy Server-Side Swift (Kitura Edition) Buy Hacking with macOS Buy Advanced iOS Volume One Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with Swift Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let me know!

Click here to visit the Hacking with Swift store >>