Last active
September 28, 2023 18:03
-
-
Save gregoryvit/18060ab134c12f2c04e3d344965a9166 to your computer and use it in GitHub Desktop.
WebView based Swift playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
import UIKit | |
import PlaygroundSupport | |
class ViewController:UIViewController{ | |
lazy var webView: UIWebView = UIWebView(frame: self.view.bounds) | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.configureWebView() | |
if let url = URL(string: <#URL String#>) { | |
let request = URLRequest(url: url) | |
self.webView.loadRequest(request) | |
} | |
} | |
private func configureWebView() { | |
self.view.addSubview(webView) | |
self.webView.delegate = self | |
} | |
} | |
extension ViewController: UIWebViewDelegate { | |
} | |
let viewController = ViewController() | |
PlaygroundPage.current.liveView = viewController.view | |
PlaygroundPage.current.needsIndefiniteExecution = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment