Created
October 27, 2020 17:43
-
-
Save xgqfrms/71a6f7471b79905fb53147b23805d382 to your computer and use it in GitHub Desktop.
SwiftUI & WKWebView
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
// | |
// SwiftUI_WKWebView.swift | |
// webview-app | |
// | |
// Created by 夏凌晨 on 2020/10/28. | |
// Copyright © 2020 webgeeker. All rights reserved. | |
// | |
import SwiftUI | |
//import Foundation | |
import WebKit | |
struct SwiftUI_WKWebView: UIViewRepresentable { | |
var url: String; | |
func makeUIView(context: Context) -> WKWebView { | |
guard let url = URL(string: self.url) else { | |
return WKWebView(); | |
} | |
let request = URLRequest(url: url); | |
let webview = WKWebView(); | |
webview.load(request); | |
return webview; | |
} | |
func updateUIView(_ uiView: WKWebView, context: Context) { | |
// | |
} | |
} |
Author
xgqfrms
commented
Oct 27, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment