LoadingView.swift (1760B)
1 /* 2 * This file is part of GNU Taler, ©2022-25 Taler Systems S.A. 3 * See LICENSE.md 4 */ 5 /** 6 * @author Marc Stibane 7 */ 8 import SwiftUI 9 import SymLog 10 11 struct LoadingView: View { 12 private let symLog = SymLogV(0) 13 let stack: CallStack 14 let scopeInfo: ScopeInfo? 15 let message: String? 16 17 // let backButtonHidden: Bool 18 let navTitle = String(localized: "Loading…") 19 20 @State private var rotationEnabled = true 21 22 var body: some View { 23 VStack(alignment: .center) { 24 Spacer() 25 RotatingTaler(size: 100, progress: true, // VoiceOver "In progress" 26 rotationEnabled: $rotationEnabled) 27 .onTapGesture(count: 1) { 28 rotationEnabled.toggle() 29 } 30 Spacer() 31 if let scopeInfo { 32 if let urlStr = scopeInfo.url { 33 Text(urlStr.trimURL) 34 } else { 35 Text(scopeInfo.currency) 36 } 37 Spacer() 38 } 39 if let message { 40 Text(message) 41 } else { 42 Text(EMPTYSTRING) 43 } 44 Spacer() 45 Spacer() 46 } 47 .frame(maxWidth: .infinity) 48 .talerFont(.title) 49 .navigationTitle("Loading…") 50 .background(WalletColors().backgroundColor.edgesIgnoringSafeArea(.all)) 51 } 52 } 53 // MARK: - 54 struct LoadingView_Previews: PreviewProvider { 55 static var previews: some View { 56 NavigationView { 57 LoadingView(stack: CallStack("Loading"), scopeInfo: nil, message: "test message") // , backButtonHidden: true) 58 .navigationBarTitleDisplayMode(.automatic) 59 }.navigationViewStyle(.stack) 60 } 61 }