view LazyBear/Views/Welcome/WelcomeView.swift @ 321:8f8d5ad3dfa0

Preparing backend requests
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sun, 28 Mar 2021 20:54:58 +0200
parents
children f3cb5bdea8e5
line wrap: on
line source

//
//  WelcomeView.swift
//  LazyBear
//
//  Created by Dennis Concepción Martín on 28/3/21.
//

import SwiftUI

struct WelcomeView: View {
    @Environment(\.presentationMode) var welcomeView
    
    var body: some View {
        GeometryReader { proxy in
            NavigationView {
                VStack {
                    Image("default")
                        .resizable()
                        .frame(width: proxy.size.width*0.3, height: proxy.size.width*0.3)
                        .cornerRadius(25)
                        .shadow(color: Color.black.opacity(0.3), radius: 10)
                        .padding(.vertical)
                    
                    Text("Lazybear")
                        .font(.largeTitle)
                        .fontWeight(.bold)
                        .padding(.bottom)
                    
                    Text("Create watchlists, add companies, and follow the markets in real time.")
                        .font(.title3)
                        .fontWeight(.semibold)
                        .multilineTextAlignment(.center)
                }
                .padding(.horizontal)
                .navigationBarTitleDisplayMode(.inline)
                .toolbar {
                    ToolbarItem(placement: .navigationBarTrailing) {
                        Button("Done", action: { dismissWelcome() })
                    }
                }
            }
        }
    }
    
    private func dismissWelcome() {
        UserDefaults.standard.set(true, forKey: "IsAppAlreadyLaunchedOnce")
        welcomeView.wrappedValue.dismiss()
    }
}

struct WelcomeView_Previews: PreviewProvider {
    static var previews: some View {
        WelcomeView()
    }
}