Files
sodalive-ios/SodaLive/Sources/Chat/Character/Recent/RecentCharacterItemView.swift
Yu Sung 62012bd722 feat(image): DownsampledKFImage 추가 및 캐릭터/배너에 공통 적용
- KFImage 공통 옵션(다운샘플링, scaleFactor, backgroundDecode,
  cancelOnDisappear, retry) 캡슐화한 DownsampledKFImage 추가
- 채팅-캐릭터 탭 Character/Recent/배너 뷰에서 인라인 KFImage 제거 → 공통 뷰 적용
- 수평 리스트 HStack → LazyHStack으로 교체해 프리로딩/메모리 개선

Why: 대형 원본 디코딩으로 인한 메모리 스파이크 완화 및 일관된
이미지 로딩 정책 적용. 유지보수성 및 성능 향상.
2025-10-23 17:10:04 +09:00

38 lines
918 B
Swift

//
// RecentCharacterItemView.swift
// SodaLive
//
// Created by klaus on 8/29/25.
//
import SwiftUI
import Kingfisher
struct RecentCharacterItemView: View {
let character: RecentCharacter
var body: some View {
VStack(spacing: 6) {
DownsampledKFImage(
url: URL(string: character.imageUrl),
size: CGSize(width: 76, height: 76)
)
.clipShape(Circle())
Text(character.name)
.font(.custom(Font.preRegular.rawValue, size: 18))
.foregroundColor(.white)
.lineLimit(1)
.frame(maxWidth: 76)
.multilineTextAlignment(.center)
}
}
}
#Preview {
RecentCharacterItemView(
character: RecentCharacter(characterId: 1, name: "앨리스", imageUrl: "https://picsum.photos/200")
)
.background(Color.black)
}