Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
import SwiftUI import WebKit struct WebView: UIViewRepresentable { let urlString: String? func makeUIView(context: Context) -> WKWebView { return WKWebView() } func updateUIView(_ uiView: WKWebView, context: Context) { if let safeString = urlString { if let url = URL(string: safeString) { let request = URLRequest(url: url) uiView.load(request) } } } } struct ContentView: View{ var body: some View{ NavigationView{ NavigationLink(destination: LinkView()) { Text("Open Link") } } } } struct LinkView: View { var body: some View { WebView(urlString: "https://stackoverflow.com/questions/71452673/making-button-open-link") } }
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)