Advertisement
TiyasAria

ResultScan

Oct 23rd, 2023
1,039
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 1.76 KB | None | 0 0
  1. //
  2. //  ResultScan.swift
  3. //  keluarga-cemara
  4. //
  5. //  Created by tiyas aria on 18/10/23.
  6. //
  7.  
  8. import SwiftUI
  9.  
  10.  
  11. struct ResultScan: View {
  12.     @EnvironmentObject private var pathStore: PathStore
  13.     @State private var isLoading : Bool = true
  14.     @State private var lightValue  : Float = 0
  15.    
  16.     var body: some View {
  17.         ZStack{
  18.             LinearGradient(colors: [Color(.firstGradientOrange), Color(.secondGradientOrange), Color(.thirdGradientOrange)], startPoint: .topLeading, endPoint: .bottomTrailing)
  19.                 .ignoresSafeArea()
  20.  
  21.            
  22.             VStack(spacing : 50){
  23.                 if isLoading{
  24.                     ProgressView()
  25.                         .progressViewStyle(CircularProgressViewStyle(tint: Color(.primaryGreen)))
  26.                         .scaleEffect(4)
  27.                         .frame( height: UIScreen.main.bounds.height / 2 )
  28.                    
  29.                 } else {
  30.                     CustomSceneViewRepresentable(isLoading: $isLoading, lightValue: lightValue)
  31.                 }
  32.                
  33.                 VStack{
  34.                     Slider(value: $lightValue, in: 0...(2 * Float.pi))
  35.                     Text("\(lightValue, specifier: "%.1f") Point")
  36.                 }
  37.                 .padding(.horizontal, 20)
  38.                 .frame(width: 400)
  39.                
  40.                 GeneralCostumButton(title: "Start mapping the sun light", action: {
  41.                     print("Testing")
  42.                 } )
  43.                
  44.             }
  45.         }
  46.         .onAppear(perform: {
  47.             DispatchQueue.global(qos: .userInitiated).asyncAfter(deadline: .now() + 2.0, execute: {
  48.                 isLoading = false
  49.             })
  50.         })
  51.     }
  52.    
  53.    
  54. }
  55.  
  56. #Preview {
  57.     ResultScan()
  58. }
  59.  
  60.  
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement