Loading Indicator evtl...
This commit is contained in:
parent
0c3eaebc80
commit
f64acd29b2
2 changed files with 72 additions and 12 deletions
Binary file not shown.
|
|
@ -10,28 +10,88 @@ import SwiftUI
|
||||||
import WebKit
|
import WebKit
|
||||||
import SafariServices
|
import SafariServices
|
||||||
|
|
||||||
|
struct LoadingWebView: View {
|
||||||
struct WebAppView: View {
|
@State private var isLoading = true
|
||||||
// @State private var page = WebPage()
|
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
ZStack {
|
||||||
if let url = URL(string: "https://git.irohlf.de") {
|
if #available(iOS 26.0, *) {
|
||||||
|
WebGitView { isLoading = false }
|
||||||
if #available(iOS 27.0, *) {
|
} else {
|
||||||
|
// Fallback on earlier versions
|
||||||
|
}
|
||||||
|
if isLoading { ProgressView() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct WebAppView: View {
|
||||||
|
// @State private var page = WebPage()
|
||||||
|
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
|
||||||
|
if let url = URL(string: "https://minecraft.irohlf.de") {
|
||||||
|
|
||||||
|
if #available(iOS 26.0, *) {
|
||||||
Text("WebView für iOS 26+")
|
Text("WebView für iOS 26+")
|
||||||
WebView(url: url)
|
WebGitView{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Text("please update to iOS 26.0 or later")
|
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")!)
|
SafariView(url: URL(string: "https://cloud.irohlf.de/s/oWYjxWJN9WwJsWq")!)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 26.0, *)
|
||||||
|
struct WebGitView: UIViewRepresentable {
|
||||||
|
|
||||||
|
|
||||||
|
func makeCoordinator() -> Coordinator {
|
||||||
|
Coordinator(parent: self)
|
||||||
|
}
|
||||||
|
let url: URL = URL(string: "https://git.irohlf.de")!
|
||||||
|
var completion: () -> Void
|
||||||
|
|
||||||
|
//typealias UIViewType = WKWebView
|
||||||
|
func makeUIView(context: Context) -> WKWebView {
|
||||||
|
let webView = WKWebView()
|
||||||
|
webView.navigationDelegate = context.coordinator
|
||||||
|
return webView
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func updateUIView(_ uiView: WKWebView, context: Context) {
|
||||||
|
uiView.load(URLRequest(url: url))
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 26.0, *)
|
||||||
|
class Coordinator: NSObject, WKNavigationDelegate {
|
||||||
|
var parent: WebGitView
|
||||||
|
init(parent: WebGitView ) {
|
||||||
|
self.parent = parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
||||||
|
print("Fertsch geladen")
|
||||||
|
}
|
||||||
|
func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
|
||||||
|
print("Bin laden")
|
||||||
|
}
|
||||||
|
|
||||||
|
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WebOldView: UIViewRepresentable {
|
struct WebOldView: UIViewRepresentable {
|
||||||
|
|
@ -58,9 +118,9 @@ struct SafariView: UIViewControllerRepresentable {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Preview {
|
#Preview {
|
||||||
WebAppView()
|
LoadingWebView()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue