Latest 0.1.0
Homepage https://github.com/teambition/WebBrowser
License MIT
Platforms ios 8.0, requires ARC
Frameworks Foundation, UIKit

A web browser using WebKit and written in Swift for iOS apps.

Example

How To Get Started

Carthage

Specify "WebBrowser" in your Cartfile:

github "teambition/WebBrowser"

CocoaPods

Specify "WebBrowser" in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'WebBrowser'

Usage

Initialization

let webBrowserViewController = WebBrowserViewController()
// assign delegate
webBrowserViewController.delegate = self

webBrowserViewController.language = .english
webBrowserViewController.tintColor = ...
webBrowserViewController.barTintColor = ...
webBrowserViewController.isToolbarHidden = false
webBrowserViewController.isShowActionBarButton = true
webBrowserViewController.toolbarItemSpace = 50
webBrowserViewController.isShowURLInNavigationBarWhenLoading = true
webBrowserViewController.isShowPageTitleInNavigationBar = true
webBrowserViewController.customApplicationActivities = ...

webBrowserViewController.loadURLString("https://www.apple.com/cn/")

Pushing to the navigation stack

navigationController?.pushViewController(webBrowserViewController, animated: true)

Presenting modally

let navigationWebBrowser = WebBrowserViewController.rootNavigationWebBrowser(webBrowser: webBrowserViewController)
present(navigationWebBrowser, animated: true, completion: nil)

Implement the delegate

func webBrowser(_ webBrowser: WebBrowserViewController, didStartLoad url: URL?) {
    // do something
}

func webBrowser(_ webBrowser: WebBrowserViewController, didFinishLoad url: URL?) {
    // do something
}

func webBrowser(_ webBrowser: WebBrowserViewController, didFailLoad url: URL?, withError error: Error) {
    // do something
}

func webBrowserWillDismiss(_ webBrowser: WebBrowserViewController) {
    // do something
}

func webBrowserDidDismiss(_ webBrowser: WebBrowserViewController) {
    // do something
}

Minimum Requirement

iOS 8.0

Localization

WebBrowser supports 5 languages: English, Simplified Chinese, Traditional Chinese, Korean, Japanese. You can set the language when initialization.

Release Notes

License

WebBrowser is released under the MIT license. See LICENSE for details.

More Info

Have a question? Please open an issue!

Latest podspec

{
    "name": "WebBrowser",
    "version": "0.1.0",
    "summary": "A web browser using WebKit and written in Swift for iOS apps.",
    "homepage": "https://github.com/teambition/WebBrowser",
    "license": {
        "type": "MIT",
        "file": "LICENSE.md"
    },
    "authors": "Xin Hong",
    "source": {
        "git": "https://github.com/teambition/WebBrowser.git",
        "tag": "0.1.0"
    },
    "source_files": "WebBrowser/*.swift",
    "resource_bundles": {
        "WebBrowser": [
            "WebBrowser/Resources/WebBrowser.xcassets",
            "WebBrowser/Resources/*/*.lproj"
        ]
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "frameworks": [
        "Foundation",
        "UIKit"
    ],
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This