Welcome to the documentation for TOWebViewController, a customizable web view controller for iOS.

About TOWebViewController

TOWebViewController is a powerful web view controller designed for iOS apps. It provides an easy way to embed web content within your app, allowing users to browse websites, view files, and interact with web-based content without leaving your app. With TOWebViewController, you can customize the appearance, behavior, and functionality of the web view to suit the needs of your app.


  • Easy integration: TOWebViewController can be easily integrated into any iOS app.
  • Customizable appearance: Customize the appearance of the web view to match your app’s theme.
  • Interactive web content: Enable user interactions such as scrolling, zooming, and navigating within the web view.
  • Toolbar customization: Add, remove, or customize buttons in the toolbar to provide additional functionality.
  • Actions sheet: Include customizable actions in an action sheet to allow users to perform actions on the web page (e.g., sharing, printing, etc.).
  • Customizable behaviors: Control how links and navigation requests are handled, including opening links externally or within the web view.
  • JavaScript and CSS injection: Inject custom JavaScript or CSS code to alter the behavior or appearance of web content.
  • Progress and error handling: Display loading progress and handle errors during web view operations.
  • Delegate support: Utilize delegate methods to receive notifications and customize the behavior of TOWebViewController.


To use TOWebViewController in your iOS app, follow the steps below:

  1. Open your Xcode project.
  2. Navigate to your project’s directory in the terminal.
  3. Run the following command to install TOWebViewController using CocoaPods:
pod 'TOWebViewController'

Alternatively, you can manually download the source files from the GitHub repository and add them to your project.


In order to use TOWebViewController in your app, follow these steps:

  1. Create an instance of TOWebViewController.
  2. Configure the appearance and behaviors of the web view using appropriate methods and properties.
  3. Present or push the TOWebViewController instance in your app’s view hierarchy.
// Create an instance of TOWebViewController
let webViewController = TOWebViewController()

// Set customizations (optional)
webViewController.showUrlWhileLoading = true
webViewController.navigationButtonsHidden = false

// Present the web view controller
self.present(webViewController, animated: true, completion: nil)


TOWebViewController provides a range of customization options to tailor the appearance and behavior of the web view. Below are some common customization examples:

Changing the Background Color

To change the background color of the web view, use the backgroundColor property:

webViewController.backgroundColor = UIColor.lightGray

Hiding the Toolbar

To hide the toolbar, set the showToolbar property to false:

webViewController.showToolbar = false

Note: By default, the toolbar is visible.

Changing the Navigation Buttons

You can customize the navigation buttons that appear in the toolbar using the navigationButtons property:

let customBackButton = UIBarButtonItem(title: "Go Back", style: .plain, target: self, action: #selector(goBack))
let customForwardButton = UIBarButtonItem(title: "Go Forward", style: .plain, target: self, action: #selector(goForward))

webViewController.navigationButtons = [customBackButton, customForwardButton]

Delegate Methods

TOWebViewController provides delegate methods that allow you to receive notifications and customize the behavior of the web view. Implement the TOWebViewControllerDelegate protocol and set the delegate to receive these notifications.

Handling a URL Request

To handle a URL request yourself instead of the web view, implement the webViewController(_:shouldStartLoadWithRequest:navigationType:) method:

func webViewController(_ webViewController: TOWebViewController, shouldStartLoadWith request: URLRequest, navigationType: UIWebView.NavigationType) -> Bool {
    // Add your custom logic here
    return true

Handling Page Load Completion

To take action after a page finishes loading, implement the webViewControllerDidFinishLoad(_ webViewController:) method:

func webViewControllerDidFinishLoad(_ webViewController: TOWebViewController) {
    // Add your custom actions here

For a complete list of available delegate methods and their descriptions, please refer to the official documentation.


Congratulations! You now have a comprehensive guide on TOWebViewController. You’ve learned about its features, installation, usage, customization options, and delegate methods. Feel free to explore additional functionalities and enhance the web browsing experience in your app using TOWebViewController.

For more information, please refer to the official GitHub repository for TOWebViewController.