refactor: AsyncImage -> KFImage 로 변경

This commit is contained in:
Yu Sung
2025-10-23 14:42:50 +09:00
parent b4e4f0f6ce
commit 1fc608a9af
3 changed files with 34 additions and 28 deletions

View File

@@ -6,6 +6,7 @@
//
import SwiftUI
import Kingfisher
struct CharacterDetailGalleryView: View {
@StateObject var viewModel = CharacterDetailGalleryViewModel()
@@ -146,16 +147,17 @@ struct CharacterDetailGalleryView: View {
ZStack {
//
AsyncImage(url: URL(string: item.imageUrl)) { image in
image
.resizable()
.scaledToFill()
.frame(width: width, height: height)
.clipped()
} placeholder: {
Rectangle()
.fill(Color.gray.opacity(0.3))
}
KFImage(URL(string: item.imageUrl))
.placeholder {
Rectangle()
.fill(Color.gray.opacity(0.3))
}
.cancelOnDisappear(true)
.downsampling(size: CGSize(width: width, height: height))
.resizable()
.scaledToFill()
.frame(width: width, height: height)
.clipped()
//
if !item.isOwned {

View File

@@ -6,6 +6,7 @@
//
import SwiftUI
import Kingfisher
struct ImageViewerView: View {
let images: [String]
@@ -18,14 +19,15 @@ struct ImageViewerView: View {
TabView(selection: $selectedIndex) {
ForEach(Array(images.enumerated()), id: \.offset) { index, imageUrl in
AsyncImage(url: URL(string: imageUrl)) { image in
image
.resizable()
.aspectRatio(contentMode: .fit)
} placeholder: {
ProgressView()
.tint(.white)
}
KFImage(URL(string: imageUrl))
.placeholder {
ProgressView()
.tint(.white)
}
.cancelOnDisappear(true)
.downsampling(size: CGSize(width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height))
.resizable()
.aspectRatio(contentMode: .fit)
.tag(index)
}
}

View File

@@ -6,6 +6,7 @@
//
import SwiftUI
import Kingfisher
struct ChatBgSelectionView: View {
@@ -77,16 +78,17 @@ struct ChatBgSelectionView: View {
ZStack(alignment: .bottomTrailing) {
//
AsyncImage(url: URL(string: item.imageUrl)) { image in
image
.resizable()
.scaledToFill()
.frame(width: width, height: height)
.clipped()
} placeholder: {
Rectangle()
.fill(Color.gray.opacity(0.3))
}
KFImage(URL(string: item.imageUrl))
.placeholder {
Rectangle()
.fill(Color.gray.opacity(0.3))
}
.cancelOnDisappear(true)
.downsampling(size: CGSize(width: width, height: height))
.resizable()
.scaledToFill()
.frame(width: width, height: height)
.clipped()
.overlay {
Rectangle()
.stroke(lineWidth: 5)