feat(image): 메인 홈, 채팅 - 톡 페이지에 DownsampledKFImage 적용

- 수평 리스트 HStack → LazyHStack으로 교체해 프리로딩/메모리 개선
This commit is contained in:
Yu Sung
2025-10-23 18:55:53 +09:00
parent 62012bd722
commit 8221746569
12 changed files with 57 additions and 72 deletions

View File

@@ -22,12 +22,11 @@ struct HomeCreatorRankingItemView: View {
var body: some View {
ZStack(alignment: .topLeading) {
VStack(spacing: 0) {
KFImage(URL(string: item.profileImageUrl))
.cancelOnDisappear(true)
.resizable()
.scaledToFill()
.frame(width: 84, height: 84, alignment: .top)
.clipShape(Circle())
DownsampledKFImage(
url: URL(string: item.profileImageUrl),
size: CGSize(width: 84, height: 84)
)
.clipShape(Circle())
Text(item.nickname)
.font(.custom(Font.preRegular.rawValue, size: 16))

View File

@@ -17,11 +17,11 @@ struct HomeLiveItemView: View {
HStack(spacing: 16) {
ZStack(alignment: .bottom) {
ZStack {
KFImage(URL(string: item.creatorProfileImage))
.cancelOnDisappear(true)
.resizable()
.frame(width: 62, height: 62)
.clipShape(Circle())
DownsampledKFImage(
url: URL(string: item.creatorProfileImage),
size: CGSize(width: 62, height: 62)
)
.clipShape(Circle())
}
.padding(7)
.overlay {

View File

@@ -93,7 +93,7 @@ struct HomeTabView: View {
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 16) {
LazyHStack(spacing: 16) {
ForEach(0..<viewModel.liveList.count, id: \.self) { index in
HomeLiveItemView(item: viewModel.liveList[index]) { roomId in
if !token.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
@@ -134,7 +134,7 @@ struct HomeTabView: View {
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 16) {
LazyHStack(spacing: 16) {
ForEach(0..<viewModel.creatorRanking.count, id: \.self) {
let item = viewModel.creatorRanking[$0]
HomeCreatorRankingItemView(
@@ -205,7 +205,7 @@ struct HomeTabView: View {
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 16) {
LazyHStack(spacing: 16) {
ForEach(0..<viewModel.originalAudioDramaList.count, id: \.self) {
SeriesItemView(item: viewModel.originalAudioDramaList[$0])
}
@@ -269,7 +269,7 @@ struct HomeTabView: View {
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 16) {
LazyHStack(spacing: 16) {
ForEach(0..<viewModel.recommendChannelList.count, id: \.self) {
RecommendChannelItemView(item: viewModel.recommendChannelList[$0])
}
@@ -293,7 +293,7 @@ struct HomeTabView: View {
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 16) {
LazyHStack(spacing: 16) {
ForEach(0..<viewModel.freeContentList.count, id: \.self) { index in
ContentItemView(item: viewModel.freeContentList[index])
}
@@ -315,7 +315,7 @@ struct HomeTabView: View {
.padding(.horizontal, 24)
ScrollView(.horizontal, showsIndicators: false) {
HStack(spacing: 16) {
LazyHStack(spacing: 16) {
ForEach(0..<curation.items.count, id: \.self) { index in
let item = curation.items[index]
ContentItemView(

View File

@@ -21,11 +21,11 @@ struct HomeWeeklyChartItemView: View {
.foregroundColor(Color(hex: "B5E7FA"))
.frame(width: 30)
KFImage(URL(string: content.coverImageUrl))
.cancelOnDisappear(true)
.resizable()
.frame(width: 60, height: 60)
.cornerRadius(12)
DownsampledKFImage(
url: URL(string: content.coverImageUrl),
size: CGSize(width: 60, height: 60)
)
.cornerRadius(12)
VStack(alignment: .leading, spacing: 6) {
Text(content.title)

View File

@@ -16,11 +16,11 @@ struct RecommendChannelContentItemView: View {
var body: some View {
HStack(spacing: 16) {
KFImage(URL(string: item.thumbnailImageUrl))
.cancelOnDisappear(true)
.resizable()
.frame(width: 60, height: 60)
.cornerRadius(12)
DownsampledKFImage(
url: URL(string: item.thumbnailImageUrl),
size: CGSize(width: 60, height: 60)
)
.cornerRadius(12)
VStack(alignment: .leading, spacing: 2) {
Text(item.title)

View File

@@ -17,12 +17,11 @@ struct RecommendChannelItemView: View {
var body: some View {
VStack(alignment: .leading, spacing: 12) {
HStack(spacing: 6) {
KFImage(URL(string: item.creatorProfileImageUrl))
.cancelOnDisappear(true)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 80, height: 80, alignment: .top)
.clipShape(Circle())
DownsampledKFImage(
url: URL(string: item.creatorProfileImageUrl),
size: CGSize(width: 80, height: 80)
)
.clipShape(Circle())
VStack(alignment: .leading, spacing: 4) {
Text(item.creatorNickname)