-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplashScreenView.swift
More file actions
52 lines (49 loc) · 1.48 KB
/
SplashScreenView.swift
File metadata and controls
52 lines (49 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
See the LICENSE.txt file for this sample’s licensing information.
Abstract:
A SwiftUI view holding the app's splash screen.
*/
import RealityKit
import SwiftUI
struct SplashScreenView: View {
@Environment(AppState.self) var appState
var body: some View {
VStack {
Text("Swift Splash")
.font(.extraLargeTitle2)
.fontWeight(.bold)
Text("Build an epic water ride this adventurous fish won’t forget.")
.frame(width: 300)
.font(.system(size: 18))
.fontWeight(.bold)
.multilineTextAlignment(.center)
.padding(.top, -5)
.padding(.bottom, 10)
if appState.phase == .loadingAssets {
ProgressView("Loading Assets…")
} else {
Button("Start Building") {
appState.startBuilding()
}
.accessibilityElement()
}
}
.offset(y: 100)
.frame(maxWidth: 600, maxHeight: 440, alignment: .center)
.background {
Image("swiftSplashHero")
.resizable()
.aspectRatio(contentMode: .fit)
.offset(y: -110)
}
.onAppear {
// Play menu music as content loads.
appState.music = .menu
}
}
}
#Preview {
SplashScreenView()
.glassBackgroundEffect()
.environment(AppState())
}