<!--
{
  "documentType" : "article",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/replacing-uiwebview-in-your-app",
  "metadataVersion" : "0.1.0",
  "role" : "article",
  "title" : "Replacing UIWebView in your app"
}
-->

# Replacing UIWebView in your app

Find a suitable alternative to handle your app’s web content.

## Discussion

If your app is using <doc://com.apple.documentation/documentation/UIKit/UIWebView>, you need to replace it with another Apple technology, because this class is now deprecated. Choose among several technologies, based on your app’s functionality and the degree of configurability you need. This article explores some alternatives and specifically the configuration and architectural changes of [`WKWebView`](/documentation/WebKit/WKWebView).

### Consider alternative technologies

Before beginning a migration away from <doc://com.apple.documentation/documentation/UIKit/UIWebView>, consider whether it can be replaced with other tools. Apple has a variety of technologies that can replace a web view to accomplish similar functionality, and possibly a richer feature set with less code.

If you need an in-app web browser and don’t need deep customization of that experience, <doc://com.apple.documentation/documentation/SafariServices/SFSafariViewController> is a good choice. It handles all the features you’d need to implement in a basic browser and more.

If you need to authenticate your users, use <doc://com.apple.documentation/documentation/AuthenticationServices/ASWebAuthenticationSession>.

If you need to display maps or map tiles, consider using <doc://com.apple.documentation/documentation/MapKit/MKMapView>.

### Update to WKWebView

If you need a high degree of configurability or are using web content in ways unrelated to browsing, use [`WKWebView`](/documentation/WebKit/WKWebView).

[`WKWebView`](/documentation/WebKit/WKWebView) isn’t a drop-in replacement for <doc://com.apple.documentation/documentation/UIKit/UIWebView>. It has a different architecture that requires rethinking how you use web views, as well as code changes to implement its functionality. You may not be able to implement some features in [`WKWebView`](/documentation/WebKit/WKWebView).

### Implement delegates for functionality

[`WKWebView`](/documentation/WebKit/WKWebView) uses various delegates to implement functionality that’s similar to <doc://com.apple.documentation/documentation/UIKit/UIWebViewDelegate>. The table below shows the <doc://com.apple.documentation/documentation/UIKit/UIWebViewDelegate> methods and their [`WKWebView`](/documentation/WebKit/WKWebView) equivalents in the [`WKNavigationDelegate`](/documentation/WebKit/WKNavigationDelegate) column.

|`UIWebViewDelegate`                                                                                                 |`WKNavigationDelegate`                                                                                                                                                                                                                          |
|--------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|<doc://com.apple.documentation/documentation/UIKit/UIWebViewDelegate/webViewDidStartLoad(_:)>                       |``doc://com.apple.webkit/documentation/WebKit/WKNavigationDelegate/webView(_:didStartProvisionalNavigation:)``                                                                                                                                  |
|<doc://com.apple.documentation/documentation/UIKit/UIWebViewDelegate/webViewDidFinishLoad(_:)>                      |``doc://com.apple.webkit/documentation/WebKit/WKNavigationDelegate/webView(_:didFinish:)``                                                                                                                                                      |
|<doc://com.apple.documentation/documentation/UIKit/UIWebViewDelegate/webView(_:didFailLoadWithError:)>              |``doc://com.apple.webkit/documentation/WebKit/WKNavigationDelegate/webView(_:didFailProvisionalNavigation:withError:)`` or ``doc://com.apple.webkit/documentation/WebKit/WKNavigationDelegate/webView(_:didFail:withError:)``                   |
|<doc://com.apple.documentation/documentation/UIKit/UIWebViewDelegate/webView(_:shouldStartLoadWith:navigationType:)>|``doc://com.apple.webkit/documentation/WebKit/WKNavigationDelegate/webView(_:decidePolicyFor:decisionHandler:)-2ni62`` or ``doc://com.apple.webkit/documentation/WebKit/WKNavigationDelegate/webView(_:decidePolicyFor:decisionHandler:)-19mn2``|
|<doc://com.apple.documentation/documentation/Foundation/NSURLConnectionDelegate/connection(_:didReceive:)>          |``doc://com.apple.webkit/documentation/WebKit/WKNavigationDelegate/webView(_:didReceive:completionHandler:)``                                                                                                                                   |

> Note:
> The ``doc://com.apple.webkit/documentation/WebKit/WKNavigationDelegate/webView(_:decidePolicyFor:decisionHandler:)-2ni62`` function doesn’t return a Boolean as its <doc://com.apple.documentation/documentation/UIKit/UIWebView> counterpart did; it uses the `decisionHandler` to return an ``doc://com.apple.webkit/documentation/WebKit/WKNavigationActionPolicy/allow`` or ``doc://com.apple.webkit/documentation/WebKit/WKNavigationActionPolicy/cancel`` value.

### Plan for architectural changes

One major architectural difference between <doc://com.apple.documentation/documentation/UIKit/UIWebView> and [`WKWebView`](/documentation/WebKit/WKWebView) is that the methods of [`WKWebView`](/documentation/WebKit/WKWebView) tend to be asynchronous, while the methods of <doc://com.apple.documentation/documentation/UIKit/UIWebView> were synchronous.

This difference requires code and architecture changes in your app. Another major change relates to creating single sign on (SSO) functionality. Cookie restrictions across the entire [`WKWebView`](/documentation/WebKit/WKWebView) landscape, mean SSO functionality in [`WKWebView`](/documentation/WebKit/WKWebView) isn’t supported for third-party cookies and clients should use a token-based authentication system like OAuth for SSO. Third-party cookies are cookies for a domain other than the domain for which the context was loaded. APIs in the <doc://com.apple.documentation/documentation/AuthenticationServices> framework are specifically built to do this.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)