From 6f4d6b741421740edf6344dc006a5c3740b27583 Mon Sep 17 00:00:00 2001 From: NinjaLikesCheez Date: Fri, 16 May 2025 11:19:03 -0400 Subject: [PATCH] Remove the web loading view Often the content the user cares about loads and is interactive before the loading is complete. Remove the view since it gets in the way. --- ios/HackerNews/Web/LoadingView.swift | 43 ---------------------------- ios/HackerNews/Web/WebView.swift | 4 +-- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 ios/HackerNews/Web/LoadingView.swift diff --git a/ios/HackerNews/Web/LoadingView.swift b/ios/HackerNews/Web/LoadingView.swift deleted file mode 100644 index 669a2fcd..00000000 --- a/ios/HackerNews/Web/LoadingView.swift +++ /dev/null @@ -1,43 +0,0 @@ -// -// LoadingView.swift -// HackerNews -// -// Created by Itay Brenner on 5/2/25. -// - -import SwiftUI -import Common - -struct LoadingView: View where Content: View { - @Binding var isShowing: Bool - var content: () -> Content - - var body: some View { - GeometryReader { geometry in - ZStack(alignment: .center) { - self.content() - .disabled(self.isShowing) - .blur(radius: self.isShowing ? 3 : 0) - - VStack { - Text("Loading...") - ProgressView() - .controlSize(.large) - } - .frame(width: geometry.size.width / 2, height: geometry.size.height / 5) - .background(Color.secondary.colorInvert()) - .foregroundColor(HNColors.orange) - .cornerRadius(20) - .opacity(self.isShowing ? 1 : 0) - - } - } - } -} - -#Preview { - LoadingView(isShowing: .constant(true)) { - Rectangle().fill(Color.black) - .frame(width: 400, height: 400) - } -} diff --git a/ios/HackerNews/Web/WebView.swift b/ios/HackerNews/Web/WebView.swift index 49496384..11614445 100644 --- a/ios/HackerNews/Web/WebView.swift +++ b/ios/HackerNews/Web/WebView.swift @@ -32,9 +32,7 @@ struct WebViewContainer: View { } var body: some View { - LoadingView(isShowing: self.$model.isLoading) { - WebView(viewModel: self.$model) - } + WebView(viewModel: self.$model) .navigationBarTitleDisplayMode(.inline) .navigationTitle(title) .toolbarBackground(.visible, for: .navigationBar)