From 75c4a4b4fa3aea3632555c82c35ce7a1a52a3be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxixn2=E2=80=9D?= Date: Sun, 29 Dec 2024 20:14:10 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20::=20[#33]=20MyPageView=20PostLi?= =?UTF-8?q?st=20Code=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DetailFeature/Sources/DetailView.swift | 1 - .../MyPageFeature/Sources/MyPageView.swift | 42 ++++++++----------- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/Projects/App/Sources/Feature/DetailFeature/Sources/DetailView.swift b/Projects/App/Sources/Feature/DetailFeature/Sources/DetailView.swift index 509edbc..eeea41f 100644 --- a/Projects/App/Sources/Feature/DetailFeature/Sources/DetailView.swift +++ b/Projects/App/Sources/Feature/DetailFeature/Sources/DetailView.swift @@ -5,7 +5,6 @@ struct DetailView: View { @State private var topNavigationState: Bool = false @State private var emojiName: [String] = ["heart", "congrats", "ThumbsUp", "thinking", "poop", "china"] @State private var emojiServerName: [String] = ["HEART", "CONGRATUATION", "THUMBSUP", "THINKING", "POOP", "CHINA"] - @State private var test: [Bool] = [false, false, false, false, false, false] @State private var graySmileState: Bool = false @Environment(\.dismiss) private var dismiss @StateObject var postViewModel: PostViewModel diff --git a/Projects/App/Sources/Feature/MyPageFeature/Sources/MyPageView.swift b/Projects/App/Sources/Feature/MyPageFeature/Sources/MyPageView.swift index 24a836a..5f691e4 100644 --- a/Projects/App/Sources/Feature/MyPageFeature/Sources/MyPageView.swift +++ b/Projects/App/Sources/Feature/MyPageFeature/Sources/MyPageView.swift @@ -120,17 +120,7 @@ struct MyPageView: View { ScrollView { LazyVGrid(columns: columns, spacing: 2) { - ForEach(postViewModel.myPostList.indices, id: \.self) { index in - let myPost = postViewModel.myPostList[index] - - let myPostEmojiArray = [ - myPost.emojiList.heartCount, - myPost.emojiList.congCount, - myPost.emojiList.thumbsCount, - myPost.emojiList.thinkCount, - myPost.emojiList.poopCount, - myPost.emojiList.chinaCount - ] + ForEach(postViewModel.myPostList, id: \.id) { myPost in NavigationLink(destination: DetailView( viewModel: DetailViewModel(), @@ -142,7 +132,14 @@ struct MyPageView: View { grade: myPost.author.grade, imageUrl: myPost.imageUrl, tagList: myPost.tagList.map { ($0.name, $0.id) }, - emojiList: myPostEmojiArray, + emojiList: [ + myPost.emojiList.heartCount, + myPost.emojiList.congCount, + myPost.emojiList.thumbsCount, + myPost.emojiList.thinkCount, + myPost.emojiList.poopCount, + myPost.emojiList.chinaCount + ], checkEmojiList: myPost.checkEmoji, createTime: myPost.createdTime )) { @@ -173,17 +170,7 @@ struct MyPageView: View { ScrollView { LazyVGrid(columns: columns1, spacing: 2) { - ForEach(postViewModel.myReactionPostList.indices, id: \.self) { index in - let rtPost = postViewModel.myReactionPostList[index] - - let emojiArray = [ - rtPost.emojiList.heartCount, - rtPost.emojiList.congCount, - rtPost.emojiList.thumbsCount, - rtPost.emojiList.thinkCount, - rtPost.emojiList.poopCount, - rtPost.emojiList.chinaCount - ] + ForEach(postViewModel.myReactionPostList, id: \.id) { rtPost in NavigationLink(destination: DetailView( viewModel: DetailViewModel(), @@ -195,7 +182,14 @@ struct MyPageView: View { grade: rtPost.author.grade, imageUrl: rtPost.imageUrl, tagList: rtPost.tagList.map { ($0.name, $0.id) }, - emojiList: emojiArray, + emojiList: [ + rtPost.emojiList.heartCount, + rtPost.emojiList.congCount, + rtPost.emojiList.thumbsCount, + rtPost.emojiList.thinkCount, + rtPost.emojiList.poopCount, + rtPost.emojiList.chinaCount + ], checkEmojiList: rtPost.checkEmoji, createTime: rtPost.createdTime )) {