Home > AI > IOS > SwiftUI >

(View)WKWebView

WebView.Swift

struct WebView: UIViewRepresentable {
 
    
    typealias UIViewType = WKWebView
    
    let url: URL
    
    func makeUIView(context: Context) -> WKWebView {
        let webView = WKWebView()
        webView.load(URLRequest(url: url))
        return webView
    }
    
    func updateUIView(_ uiView: UIViewType, context: Context) {
        
    }
}

ContentView.swift

struct ContentView: View {
    var body: some View {
        WebView(url: URL(string: "https://www.jobyme88.com/?st_design=yellow-classroom")!)
    }
}

Leave a Reply