Swift version: 5.6
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?
Well, there are several differences, but two are particularly important. First,
UIWebView is part of UIKit, and thus is available to your apps as standard. You don't need to import anything – it's just there. This also means it's available inside Interface Builder, so you can drag and drop web view into your designs.
WKWebView loads web pages faster and more efficiently than
UIWebView, and also doesn't have as much memory overhead for you.
In iOS 8.0
WKWebView was unable to load local files, but this got fixed in iOS 9.0. The main reason to use
UIWebView nowadays is for access to older features such as "Scale pages to fit" - this is not available in
SPONSORED Play is the first native iOS design tool created for designers and engineers. You can install Play for iOS and iPad today and sign up to check out the Beta of our macOS app with SwiftUI code export. We're also hiring engineers!
Available from iOS 8.0 – see Hacking with Swift tutorial 4
This is part of the Swift Knowledge Base, a free, searchable collection of solutions for common iOS questions.
Link copied to your pasteboard.