loading and error handling

This commit is contained in:
leminlimez committed 2025-07-11 11:15:52 -04:00
1 parent edde7ddb0c
commit e932b82515
4 files changed
+68 -4

No files matched your search

@@ -8,7 +8,30 @@
import SwiftUI
struct ExploreView: View {
@State private var isLoading = true
@State private var error: Error? = nil
var body: some View {
WallpaperWebView(URL(string: "https://cowabun.ga/wallpapers?pocketposter=true")!)
ZStack {
if let error = error {
VStack {
Text(error.localizedDescription)
.foregroundStyle(.red)
Button(action: {
isLoading = true
self.error = nil
}) {
Text("Retry")
}
}
} else if let url = URL(string: "https://cowabun.ga/wallpapers?pocketposter=true") {
WallpaperWebView(url, isLoading: $isLoading, error: $error)
if isLoading {
ProgressView()
}
} else {
Text("Failed to load explore page.")
}
}
}
}