Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Refeel/RefeelApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,24 @@ import SwiftData

@main
struct RefeelApp: App {
// 앱 스토리지로 첫 실행 유저 인지 판별
@AppStorage("hasLaunchedBefore") private var isFirstLaunchCompleted = false
@State private var isSplashActive = true

var body: some Scene {
WindowGroup {
if isSplashActive {
SplashView(isActive: $isSplashActive)
if isFirstLaunchCompleted {
// 첫 실행 유저가 아니면 로고 스플래시 화면 , 1.5 초
LogoOnlySplashView(isActive: $isSplashActive)
} else {
// 첫 실행 유저면 글 쓰는 스플래시 화면 , 3초
FirstLaunchedSplashView(isActive: $isSplashActive, isFirstLaunch: $isFirstLaunchCompleted)
}
} else {
CustomMainTabView()
}
}
.modelContainer(for: Retrospect.self)

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

import SwiftUI

struct SplashView: View {
struct FirstLaunchedSplashView: View {
@Binding var isActive: Bool
@Binding var isFirstLaunch: Bool
@State private var textToShow = ""
@State private var isTyping = true
@State private var isErasing = false
Expand Down Expand Up @@ -38,6 +39,7 @@ struct SplashView: View {
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 3.0) {
self.isActive = false
self.isFirstLaunch = true
}
}
}
Expand Down Expand Up @@ -95,8 +97,8 @@ struct SplashView: View {
}
}

struct SplashView_Previews: PreviewProvider {
struct FirstLaunchedSplashView_Previews: PreviewProvider {
static var previews: some View {
SplashView(isActive: .constant(true))
FirstLaunchedSplashView(isActive: .constant(true), isFirstLaunch: .constant(true))
}
}
27 changes: 27 additions & 0 deletions Refeel/Views/Splash/LogoOnlySplashView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// LogoOnlySplashView.swift
// Refeel
//
// Created by Abel on 5/15/25.
//

import SwiftUI

struct LogoOnlySplashView: View {
@Binding var isActive: Bool
var body: some View {
ZStack {
Color.white.ignoresSafeArea()
Image("refeel")
}
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
self.isActive = false
}
}
}
}

#Preview {
LogoOnlySplashView(isActive: .constant(true))
}
Loading