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
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFD",
"green" : "0xFD",
"red" : "0xFF"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFD",
"green" : "0xFD",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xE6",
"green" : "0xE0",
"red" : "0xFA"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xE6",
"green" : "0xE0",
"red" : "0xFA"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "splash_logo.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "splash_logo@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "splash_logo@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ import Foundation
import SwiftUI

enum AppState {
case splash
case onboarding
case home
}

final class AppCoordinator: ObservableObject {
@Published var path: NavigationPath = NavigationPath()
@Published var appState: AppState = .onboarding
@Published var appState: AppState = .splash

func navigationToTabbar() {
path.removeLast(path.count)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ struct AppCoordinatorView: View {
var body: some View {
Group {
switch appCoordinator.appState {
case .splash:
SplashView()
case .onboarding:
OnboardingCoordinatorView()
case .home:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// SplashView.swift
// Cherrish-iOS
//
// Created by 이나연 on 1/17/26.
//

import SwiftUI

struct SplashView: View {
@EnvironmentObject private var appCoordinator: AppCoordinator

var body: some View {
ZStack(alignment: .center) {
LinearGradient(
gradient: Gradient(stops: [
.init(color: .splashGradient1, location: 0.6),
.init(color: .splashGradient2, location: 1.0)
]),
startPoint: .topLeading,
endPoint: .bottomTrailing
)

Image(.appicon)
}
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
appCoordinator.navigationToOnboarding()
}
}
Comment on lines +26 to +30
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

뷰 생명주기 관리를 위해 Task 사용을 권장합니다.

DispatchQueue.main.asyncAfter는 뷰가 사라져도 취소되지 않습니다. 뷰가 일찍 해제될 경우 예기치 않은 동작이 발생할 수 있습니다. Task를 사용하면 뷰가 사라질 때 자동으로 취소됩니다.

♻️ 권장 수정안
-        .onAppear {
-            DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
-                appCoordinator.navigationToOnboarding()
-            }
-        }
+        .task {
+            try? await Task.sleep(nanoseconds: 3_000_000_000)
+            appCoordinator.navigationToOnboarding()
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
appCoordinator.navigationToOnboarding()
}
}
.task {
try? await Task.sleep(nanoseconds: 3_000_000_000)
appCoordinator.navigationToOnboarding()
}
🤖 Prompt for AI Agents
In `@Cherrish-iOS/Cherrish-iOS/Presentation/Feature/Onboarding/SplashView.swift`
around lines 26 - 30, Replace the DispatchQueue-based delay in SplashView's
onAppear with a Swift concurrency Task tied to the view lifecycle so it cancels
when the view disappears: remove the DispatchQueue.main.asyncAfter block and use
a .task (or Task in onAppear tied to the view) that awaits Task.sleep for 3
seconds (3_000_000_000 nanoseconds) then calls
appCoordinator.navigationToOnboarding() on the MainActor; ensure you use
try/await and MainActor.run (or `@MainActor`) when invoking
appCoordinator.navigationToOnboarding to keep UI work on the main thread.

.ignoresSafeArea()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private struct TreatmentCheckBoxView: View {
isSelected: Binding<Bool>,
isCompleted: Binding<Bool>,
isCompletedView: Bool = false,
action: @escaping () -> Void,
action: @escaping () -> Void
) {
self.treatmentEntity = treatmentEntity
self._isSelected = isSelected
Expand Down