NowWebViewController class - iOS

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 3분
  • The NowWebViewController class provides functions that enable you to manage a web viewer.

    Web page load flow

    NowWebViewController - loadPage()

    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.

    표 1. Parameters
    Name Type Description
    None
    표 2. Returns
    Type Description
    None

    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)

    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.

    표 3. Parameters
    Name Type Description
    themeColors NowWebThemeable Theme to update the web UI with.
    표 4. Returns
    Type Description
    None

    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())
    }