A very simple modal webview for display web pages inside your app.
example.mp4
modal_webview is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'modal_webview'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)
}
}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")
}
}João Morais, [email protected]
modal_webview is available under the MIT license. See the LICENSE file for more info.