Coder Social home page Coder Social logo

webbrowser's Introduction

WebBrowser

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!

webbrowser's People

Contributors

hongxinhope avatar horexc avatar wzxha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

webbrowser's Issues

Forward and Back Buttons don't show up

Forward and Back Buttons just don't appear. I've checked the code and log but everything seems ok

Even if I changed it to another file it didn't work

fileprivate lazy var backButton: UIBarButtonItem = {
        let backIcon = UIImage(named: "myPNG")
        let backButton = UIBarButtonItem(image: backIcon, style: .done, target: self, action: #selector(WebBrowserViewController.backButtonTapped(_:)))
        return backButton
    }()

It worked only if I used UIImage instead of WebBrowser.image AND used another image

so it seems like there is not only a problem with the code but also the image

Seems like it can't access the pods assets

.
UPDATE : Fixed it

I fixed it, but I will keep this issue open, bc it needs to be fixed in code on this github
This is also probably not the way it was intended, but it show temporary fix it until an update

What I did:

  • Replace let backIcon = WebBrowser.image(named: "myPNG") with let backIcon = UIImage(named: "myPNG")

  • Move those assets from the Pods Assets to your Proj assets!

Download a large file to local storage?

Sorry, this is a general question and not really a bug or suggestion..

Is it possible to click on a .mp3 link and intercept it so that can be downloaded to the documents? It comes up and starts to play, but I'm not sure if there is a way to avoid the built-in player or return some kind of "don't do default action" and download the file some way.

I am reading and it looks like javascript injection may be a good option.. But wanted to see what people recommend.

Thanks for this nice code!

可以全屏浏览吗?

可以设置全屏浏览吗?另外什么时候能够添加Pod安装?Cartfile用起来太不方便了。

WebBrowser

I am new to Swift and iOS. I am interested in learning about and using your WebBrowesr app, but it is a little more advanced than I am used to. How should I go about deploying the app? Should I first create my own Xcode project and then install the cocoapods from github? I see an initialize snippet on the github page, where do I place that code? Also, there are a few parameters in the snippet with only ... placed after them, are these parameters required and what are my options for the ones with the three dots after them? If you can answer this question for me, that would be helpful, however, I may have some more afterwards. Thank you, for any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.