Created
March 27, 2023 16:29
-
-
Save davidrohweder/941221ff66c7c221837de7a0bd43ed91 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import SwiftUI | |
struct ContentView: View { | |
let svgURL = URL(string: "URL TO YOUR SVG")! | |
var body: some View { | |
WebView(url: svgURL) | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
This file contains hidden or 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
import SwiftUI | |
import WebKit | |
struct WebView: UIViewRepresentable { | |
let url: URL | |
func makeUIView(context: Context) -> WKWebView { | |
let webView = WKWebView() | |
webView.load(URLRequest(url: url)) | |
return webView | |
} | |
func updateUIView(_ uiView: WKWebView, context: Context) { | |
// Nothing to update | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment