---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# NowWebViewController class - iOS

# NowWebViewController class - iOS {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

The NowWebViewController class provides functions that enable you to
manage a web viewer.

## NowWebViewController - loadPage() {#ariaid-title2}

If the request is authenticated, starts loading the initial URL provided during
instantiation using the makeWebViewController() method.
If the request fails authentication, the method
nowWebViewController(_:didFailNavigationWith:) is called on the
delegate that was passed when instantiating the object.
{#NWVC-loadPage__table_ymy_tpy_5pb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#NWVC-loadPage__table_ymy_tpy_5pb} {#NWVC-loadPage__table_zmy_tpy_5pb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 2. Returns]

{#NWVC-loadPage__table_zmy_tpy_5pb}  
The following code example shows how to call this function.

    private func openScreen(_ screen: ArticleListViewModel.Screen) {
      switch screen {
      case .articleDetail(let sysId):
        guard let url = URL(string: "/mesp?id=me_kb_view&sys_kb_id=\(sysId)"), let webViewController = webViewController(for: url) else {
          debugPrint("Could not create web view")
          return
        }
        webViewController.loadPage()
        navigationController?.pushViewController(webViewController, animated: true)
      }
    }

## NowWebViewController - updateTheme(themeColors: NowWebThemeable) {#ariaid-title3}

Updates the NowWebView theme with the specified UI theme. Use this function to update the web UI theme after it has been initially set using the makeWebViewController() function, such as when changing the
theme from light to dark.
{#NWVC-updateTheme_O__table_i4g_dww_x2c__entry__3}

| Name | Type | Description |
|-|-|-|
| themeColors | [NowWebThemeable](https://servicenow-prod.fluidtopics.net/tnrimlkuyE5LdmZT0XBA1w "The NowWebThemeable protocol provides properties that enable you to override the colors used within web pages hosted on your ServiceNow instance in a native web view.") | Theme to update the web UI with. |
[Table 3. Parameters]

{#NWVC-updateTheme_O__table_i4g_dww_x2c} {#NWVC-updateTheme_O__table_j4g_dww_x2c__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 4. Returns]

{#NWVC-updateTheme_O__table_j4g_dww_x2c}  
The following code example shows how to update a light UI theme implemented using the makeWebViewController() function to the dark UI theme using the updateTheme() function.

    func nowWebViewController(_ nowWebViewController: NowWebViewController, systemThemeDidChange traitCollection: UITraitCollection) {
      // The systemThemeDidChange delegate method can be used to call updateTheme() to apply theme changes when the system theme changes.
      nowWebViewController.updateTheme(themeColors: traitCollection.userInterfaceStyle == .dark ? DarkNowWebTheme() : LightNowWebTheme())
    }


