CocoaPods trunk is moving to be read-only. Read more on the blog, there are 7 months to go.

modal_webview 1.0.0

modal_webview 1.0.0

Maintained by João Morais.



  • By
  • João Pedro

Modal Webview

A very simple modal webview for display web pages inside your app.

example.mp4

Requirements

Installation

modal_webview is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'modal_webview'

Usage

After import the library import modal_webview, instantiate the class and qual the show method:

class ViewController: UIViewController {

    let webview = ModalWebview()
    var url = URL(string: "https://developer.apple.com/")!

    func showBrowserAction(){
        webview.show(controller: self, url: url)
    }
}

Delegate

You can easily track events ocurring on the webView by implementing the delegate:

class ViewController: UIViewController {

     override func viewDidLoad() {
         super.viewDidLoad()
         webview.delegate = self
     }
}
extension ViewController: ModalWebviewProtocol{
    func didClose() {
        print("Closed")
    }
    
    func didFailOpenUrl(){
        print("Did failed to open URL")
    }
}

Author

João Morais, [email protected]

License

modal_webview is available under the MIT license. See the LICENSE file for more info.