ios swift webView

1.@IBOutlet weak var webView: UIWebView!

2.let url = URL(fileURLWithPath: "http://www.baidu.com")

3.let urlRequest  = URLRequest(url: url)

4.webView.loadRequest(urlRequest)

5.info.plist配置相关的权限

    App Transport Security Settings

    Allow Arbitrary Loads ------- YES

你可能感兴趣的:(ios swift webView)