- 배너/최근/신규/큐레이션 섹션 UI 구성 및 데이터 바인딩 - 네트워크 이미지 로더를 Kingfisher(KFImage)로 교체하여 캐싱/재시도 지원 - CharacterApi에 토큰 헤더 포함, GET /api/chat/character/main 연동
		
			
				
	
	
		
			51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Swift
		
	
	
	
	
	
//
 | 
						|
//  CharacterItemView.swift
 | 
						|
//  SodaLive
 | 
						|
//
 | 
						|
//  Created by klaus on 8/29/25.
 | 
						|
//
 | 
						|
 | 
						|
import SwiftUI
 | 
						|
import Kingfisher
 | 
						|
 | 
						|
struct CharacterItemView: View {
 | 
						|
    
 | 
						|
    let character: Character
 | 
						|
    let size: CGFloat
 | 
						|
    
 | 
						|
    var body: some View {
 | 
						|
        VStack(alignment: .leading, spacing: 4) {
 | 
						|
            KFImage(URL(string: character.imageUrl))
 | 
						|
                .placeholder { Color.gray.opacity(0.2) }
 | 
						|
                .retry(maxCount: 2, interval: .seconds(1))
 | 
						|
                .cancelOnDisappear(true)
 | 
						|
                .resizable()
 | 
						|
                .scaledToFill()
 | 
						|
                .frame(width: size, height: size)
 | 
						|
                .clipped()
 | 
						|
                .cornerRadius(12)
 | 
						|
            
 | 
						|
            Text(character.name)
 | 
						|
                .font(.custom(Font.preRegular.rawValue, size: 18))
 | 
						|
                .foregroundColor(.white)
 | 
						|
                .lineLimit(1)
 | 
						|
                .truncationMode(.tail)
 | 
						|
            
 | 
						|
            if let desc = character.description, !desc.isEmpty {
 | 
						|
                Text(desc)
 | 
						|
                    .font(.custom(Font.preRegular.rawValue, size: 14))
 | 
						|
                    .foregroundColor(Color(hex: "78909C"))
 | 
						|
                    .lineLimit(1)
 | 
						|
            }
 | 
						|
        }
 | 
						|
        .frame(width: size, alignment: .leading)
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
#Preview {
 | 
						|
    CharacterItemView(
 | 
						|
        character: Character(characterId: 1, name: "찰리", description: "새로운 친구", imageUrl: "https://picsum.photos/300"),
 | 
						|
        size: 168
 | 
						|
    )
 | 
						|
}
 |