Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  SplashScreenView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 6/13/22.
6
//
7
 
8
import SwiftUI
9
 
10
 
11
struct SplashScreenView: View {
12
 
13
    @EnvironmentObject private var appNavigation : AppNavigation
21 efrain 14
    private var appData = Environment(\.appData).wrappedValue
1 efrain 15
 
16
    @State var delay: Double = 0.6 // 1.
17
    @State var scale: CGFloat = 0.5
18
    @State var opacity: Double = 0.5 // 1.
19
 
20
 
21
    var body: some View {
22
 
23
            VStack(spacing: 0) {
24
                Image("logo")
25
                .resizable()
26
                .frame(width: UIScreen.main.bounds.width / 2)
27
                . aspectRatio(contentMode: .fit)
28
                .scaleEffect(scale)
29
                .opacity(opacity)
30
 
31
 
32
                .clipShape(Circle())
33
                .overlay(Circle().stroke(Color.white, lineWidth: 4))
34
                .shadow(radius: 15)
35
                .animation(Animation.easeInOut(duration: 0.8).repeatForever().delay(delay)) // 2.
36
                .onAppear {
37
                    withAnimation {
38
                        self.scale = 1
39
                        self.opacity = 1
40
                    }
41
                }
42
            }
43
            .onAppear {
44
                DispatchQueue.main.asyncAfter(deadline: .now() + 4.0) {
45
                    withAnimation {
46
                        if(appData.userUuid.isEmpty) {
47
                            appNavigation.pageActive = AppMainPage.intro1
48
                        } else {
49
                            appNavigation.pageActive = AppMainPage.home
50
 
51
 
52
                        }
53
 
54
                    }
55
                }
56
            }
57
 
58
    }
59
}
60
 
61
struct SplashScreenView_Previews: PreviewProvider {
62
    static var previews: some View {
63
        SplashScreenView()
64
    }
65
}
66