alte WebView vor iOS 26 und SafariView mit controls

This commit is contained in:
Ingo Rohlf 2025-10-23 14:00:17 +02:00
parent 42b110637a
commit 0c3eaebc80
2 changed files with 18 additions and 3 deletions

View file

@ -8,7 +8,7 @@
import SwiftUI
import WebKit
import SafariServices
struct WebAppView: View {
@ -24,7 +24,9 @@ struct WebAppView: View {
} else {
Text("please update to iOS 26.0 or later")
WebOldView(url: URL(string: "https://ai.irohlf.de")!)
// WebOldView(url: URL(string: "https://ai.irohlf.de")!)
SafariView(url: URL(string: "https://cloud.irohlf.de/s/oWYjxWJN9WwJsWq")!)
}
}
@ -34,7 +36,7 @@ struct WebAppView: View {
struct WebOldView: UIViewRepresentable {
let url: URL
typealias UIViewType = WKWebView
//typealias UIViewType = WKWebView
func makeUIView(context: Context) -> WKWebView {
.init()
}
@ -44,6 +46,19 @@ struct WebOldView: UIViewRepresentable {
}
struct SafariView: UIViewControllerRepresentable {
let url: URL
/// typealias UIViewControllerType = SFSafariViewController
func makeUIViewController(context: Context) -> SFSafariViewController {
.init(url: url)
}
func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) {
}
}
#Preview {