Skip to content

Release 1.1.0

Choose a tag to compare

@junil1030 junil1030 released this 22 Dec 06:07
· 5 commits to main since this release

🎉 New Features

SwiftUI Support

  • CachedAsyncImage 컴포넌트 추가
    • SwiftUI에서 네이티브하게 사용할 수 있는 비동기 이미지 로딩 뷰
    • 커스텀 content 및 placeholder 지원
    • UIKit의 모든 캐싱 전략(memory, disk, both)과 호환
    • Task 기반의 자동 취소 및 메모리 관리
CachedAsyncImage(
    url: imageURL,
    targetSize: CGSize(width: 300, height: 300)
) { image in
    image
        .resizable()
        .aspectRatio(contentMode: .fill)
} placeholder: {
      ProgressView()
}

Custom Headers

  • 기본 헤더 설정 지원
    • CacheConfiguration에 defaultHeaders 프로퍼티 추가
    • 모든 네트워크 요청에 적용되는 공통 헤더 설정 가능
    • 인증이 필요한 이미지 엔드포인트 지원
var config = CacheConfiguration()
config.defaultHeaders = [
    "Authorization": "Bearer \(accessToken)"
]
  • 요청별 커스텀 헤더 지원
    • loadImage(), ck_setImage(), CachedAsyncImage 모두 headers 파라미터 추가
    • 요청별 헤더는 기본 헤더와 병합됨 (요청별 헤더가 우선순위)
    • 특정 요청에만 필요한 헤더를 동적으로 추가 가능
// UIKit
imageView.ck_setImage(
    with: url,
    targetSize: size,
    headers: ["X-Custom-Header": "value"]
)

// SwiftUI
CachedAsyncImage(
    url: url,
    targetSize: size,
    headers: ["X-Custom-Header": "value"]
)