diff --git a/Projects/Features/HomeFeature/Sources/HomeView.swift b/Projects/Features/HomeFeature/Sources/HomeView.swift index af4c3d57..1721fc1c 100644 --- a/Projects/Features/HomeFeature/Sources/HomeView.swift +++ b/Projects/Features/HomeFeature/Sources/HomeView.swift @@ -44,14 +44,20 @@ struct HomeView: View { } label: { NoticeView() } + .offset(x: viewModel.isExistNewNotice ? 0 : 50) + .opacity(viewModel.isExistNewNotice ? 1 : 0) + .animation( + .easeInOut(duration: 1), + value: viewModel.isExistNewNotice + ) } Text("오늘의 급식") .dmsFont(.title(.title1), color: .GrayScale.gray7) - .padding(.top, viewModel.isExistNewNotice ? 16 : 46) + .padding(.top, viewModel.isExistNewNotice ? 10 : 46) selectDateView() - .padding(.top, 24) + .padding(.top, 15) MealCarouselView( meal: viewModel.selectedDateMeal, diff --git a/Projects/Features/HomeFeature/Sources/HomeViewModel.swift b/Projects/Features/HomeFeature/Sources/HomeViewModel.swift index 4a9bbd89..63a6c45d 100644 --- a/Projects/Features/HomeFeature/Sources/HomeViewModel.swift +++ b/Projects/Features/HomeFeature/Sources/HomeViewModel.swift @@ -4,10 +4,11 @@ import DomainModule import ErrorModule import Foundation import Utility +import SwiftUI final class HomeViewModel: BaseViewModel { @Published var selectedDate = Date() - @Published var isExistNewNotice = true + @Published var isExistNewNotice = false @Published var meals: [String: MealEntity] = [:] @Published var prevMonth = Date().month var selectedDateString: String { @@ -36,7 +37,11 @@ final class HomeViewModel: BaseViewModel { func onAppear() { addCancellable(fetchWhetherNewNoticeUseCase.execute()) { [weak self] isExistNewNotice in - self?.isExistNewNotice = isExistNewNotice + DispatchQueue.main.asyncAfter(deadline: .now() + 0.25) { + withAnimation { + self?.isExistNewNotice = isExistNewNotice + } + } } }