Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 165 additions & 0 deletions Docs/README.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# SmartAsyncImage

Un `AsyncImage` para SwiftUI (iOS) mas inteligente y rapido, con cache en memoria y en disco, cancelacion y concurrencia de Swift 6.

[![CI](https://github.com/gentle-giraffe-apps/SmartAsyncImage/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/gentle-giraffe-apps/SmartAsyncImage/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/gentle-giraffe-apps/SmartAsyncImage/branch/main/graph/badge.svg)](https://codecov.io/gh/gentle-giraffe-apps/SmartAsyncImage)
[![Swift](https://img.shields.io/badge/Swift-6.1+-orange.svg)](https://swift.org)
![Bazel](https://img.shields.io/badge/Bazel-enabled-555?logo=bazel)
[![SPM Compatible](https://img.shields.io/badge/SPM-Compatible-brightgreen.svg)](https://swift.org/package-manager/)
[![Platforms](https://img.shields.io/badge/platforms-iOS%2017%2B-blue)](https://developer.apple.com/ios/)
![Commit activity](https://img.shields.io/github/commit-activity/y/gentle-giraffe-apps/SmartAsyncImage)
![Last commit](https://img.shields.io/github/last-commit/gentle-giraffe-apps/SmartAsyncImage)
[![DeepSource](https://app.deepsource.com/gh/gentle-giraffe-apps/SmartAsyncImage.svg/?label=active+issues&show_trend=true)](https://app.deepsource.com/gh/gentle-giraffe-apps/SmartAsyncImage/)

> **Idioma** · [English](../README.md) · Español · [Português (Brasil)](README.pt-BR.md) · [日本語](README.ja.md)

## Caracteristicas
- API compatible con SwiftUI con un view model observable
- Manejo inteligente de fases: `empty`, `loading`, `success(Image)`, `failure(Error)`
- Protocolo de cache en memoria con implementaciones intercambiables
- Cache en disco para persistencia entre ejecuciones
- Concurrencia de Swift (`async/await`) con cancelacion cooperativa
- Actualizaciones de estado seguras en MainActor

💬 **[Participa en la discusion. Comentarios y preguntas son bienvenidos](https://github.com/gentle-giraffe-apps/SmartAsyncImage/discussions)**

## Requisitos
- iOS 17+
- Swift 6.1+
- Swift Package Manager

## 📦 Instalacion (Swift Package Manager)

### Via Xcode

1. Abre tu proyecto en Xcode
2. Ve a **File → Add Packages...**
3. Ingresa la URL del repositorio: `https://github.com/gentle-giraffe-apps/SmartAsyncImage.git`
4. Elige una regla de version (o `main` durante el desarrollo)
5. Agrega el producto **SmartAsyncImage** a tu target de la app

### Via `Package.swift`

```swift
dependencies: [
.package(url: "https://github.com/gentle-giraffe-apps/SmartAsyncImage.git", from: "1.0.0")
]
```

Luego agrega `"SmartAsyncImage"` a las `dependencies` de tu target.

## App de Demostracion

Se incluye una app de demostracion en SwiftUI en este repositorio usando una referencia local al paquete.

**Ruta:**
```
Demo/SmartAsyncImageDemo/SmartAsyncImageDemo.xcodeproj
```

### Como Ejecutar
1. Clona el repositorio:
```bash
git clone https://github.com/gentle-giraffe-apps/SmartAsyncImage.git
```
2. Abre el proyecto de demostracion:
```
Demo/SmartAsyncImageDemo/SmartAsyncImageDemo.xcodeproj
```
3. Selecciona un simulador con iOS 17+.
4. Compila y ejecuta (⌘R).

El proyecto esta preconfigurado con una referencia local de Swift Package a `SmartAsyncImage` y deberia ejecutarse sin configuracion adicional.

## Uso

### Ejemplo Rapido (SwiftUI)
```swift
import SwiftUI
import SmartAsyncImage

struct MinimalRemoteImageView: View {
let imageURL = URL(string: "https://picsum.photos/300")

var body: some View {

// reemplaza: AsyncImage(url: imageURL) { phase in
// ------------------------------------------------
// con:

SmartAsyncImage(url: imageURL) { phase in

// ------------------------------------------------

switch phase {
case .empty, .loading:
ProgressView()
case .success(let image):
image.resizable().scaledToFit()
case .failure:
Image(systemName: "photo")
}
}
.frame(width: 150, height: 150)
}
}
```

## Calidad y Herramientas

Este proyecto aplica controles de calidad mediante CI y analisis estatico:

- **CI:** Todos los commits a `main` deben pasar las verificaciones de GitHub Actions
- **Analisis estatico:** DeepSource se ejecuta en cada commit a `main`.
La insignia indica el numero actual de problemas pendientes de analisis estatico.
- **Cobertura de tests:** Codecov reporta la cobertura de lineas para la rama `main`

<sub><strong>Captura de Codecov</strong></sub><br/>
<a href="https://codecov.io/gh/gentle-giraffe-apps/SmartAsyncImage">
<img
src="https://codecov.io/gh/gentle-giraffe-apps/SmartAsyncImage/graphs/icicle.svg"
height="80"
alt="Captura de cobertura de codigo por archivo y modulo (grafico de arbol de Codecov)"
/>
</a>

Estas verificaciones tienen como objetivo mantener el sistema de diseno seguro para evolucionar con el tiempo.

---

## Arquitectura

```mermaid
flowchart TD
SAI["SmartAsyncImage<br/>(SwiftUI View)"] --> VM["SmartAsyncImage<br/>ViewModel"]
VM --> Phase["SmartAsyncImage<br/>Phase"]
VM --> MemProto["SmartAsyncImageMemory<br/>CacheProtocol"]
MemProto --> Mem["SmartAsyncImage<br/>MemoryCache<br/>(actor)"]
Mem --> Disk["SmartAsyncImage<br/>DiskCache"]
Disk --> Encoder["SmartAsyncImage<br/>Encoder"]
Mem --> URLSession[["URLSession"]]
```

---

## 🤖 Nota sobre Herramientas

Partes de la redaccion y el refinamiento editorial en este repositorio fueron aceleradas utilizando modelos de lenguaje grandes (incluyendo ChatGPT, Claude y Gemini) bajo diseno, validacion y aprobacion final humana directa. Todas las decisiones tecnicas, el codigo y las conclusiones arquitectonicas son de autoria y verificacion del mantenedor del repositorio.

---

## 🔐 Licencia

Licencia MIT
Libre para uso personal y comercial.

---

## 👤 Autor

Creado por **Jonathan Ritchey**
Gentle Giraffe Apps
Ingeniero Senior de iOS --- Swift | SwiftUI | Concurrency

![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Fgentle-giraffe-apps%2FSmartAsyncImage)
165 changes: 165 additions & 0 deletions Docs/README.ja.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# SmartAsyncImage

SwiftUI (iOS) 向けの、より高速でスマートな `AsyncImage`。メモリ・ディスクキャッシュ、キャンセル、Swift 6 の並行処理を内蔵しています。

[![CI](https://github.com/gentle-giraffe-apps/SmartAsyncImage/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/gentle-giraffe-apps/SmartAsyncImage/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/gentle-giraffe-apps/SmartAsyncImage/branch/main/graph/badge.svg)](https://codecov.io/gh/gentle-giraffe-apps/SmartAsyncImage)
[![Swift](https://img.shields.io/badge/Swift-6.1+-orange.svg)](https://swift.org)
![Bazel](https://img.shields.io/badge/Bazel-enabled-555?logo=bazel)
[![SPM Compatible](https://img.shields.io/badge/SPM-Compatible-brightgreen.svg)](https://swift.org/package-manager/)
[![Platforms](https://img.shields.io/badge/platforms-iOS%2017%2B-blue)](https://developer.apple.com/ios/)
![Commit activity](https://img.shields.io/github/commit-activity/y/gentle-giraffe-apps/SmartAsyncImage)
![Last commit](https://img.shields.io/github/last-commit/gentle-giraffe-apps/SmartAsyncImage)
[![DeepSource](https://app.deepsource.com/gh/gentle-giraffe-apps/SmartAsyncImage.svg/?label=active+issues&show_trend=true)](https://app.deepsource.com/gh/gentle-giraffe-apps/SmartAsyncImage/)

> **言語** · [English](../README.md) · [Español](README.es.md) · [Português (Brasil)](README.pt-BR.md) · 日本語

## 特徴
- Observable なビューモデルを備えた SwiftUI 対応 API
- スマートなフェーズ管理: `empty`、`loading`、`success(Image)`、`failure(Error)`
- プラグイン可能な実装を持つメモリキャッシュプロトコル
- アプリの再起動をまたぐディスクキャッシュ
- Swift Concurrency (`async/await`) による協調的キャンセル
- MainActor で安全な状態更新

💬 **[ディスカッションに参加しましょう。フィードバックや質問を歓迎します](https://github.com/gentle-giraffe-apps/SmartAsyncImage/discussions)**

## 要件
- iOS 17+
- Swift 6.1+
- Swift Package Manager

## 📦 インストール (Swift Package Manager)

### Xcode 経由

1. Xcode でプロジェクトを開く
2. **File → Add Packages...** に移動
3. リポジトリ URL を入力: `https://github.com/gentle-giraffe-apps/SmartAsyncImage.git`
4. バージョンルールを選択(開発中は `main` でも可)
5. **SmartAsyncImage** プロダクトをアプリターゲットに追加

### `Package.swift` 経由

```swift
dependencies: [
.package(url: "https://github.com/gentle-giraffe-apps/SmartAsyncImage.git", from: "1.0.0")
]
```

次に、ターゲットの `dependencies` に `"SmartAsyncImage"` を追加します。

## デモアプリ

ローカルパッケージ参照を使用した SwiftUI デモアプリがこのリポジトリに含まれています。

**パス:**
```
Demo/SmartAsyncImageDemo/SmartAsyncImageDemo.xcodeproj
```

### 実行方法
1. リポジトリをクローン:
```bash
git clone https://github.com/gentle-giraffe-apps/SmartAsyncImage.git
```
2. デモプロジェクトを開く:
```
Demo/SmartAsyncImageDemo/SmartAsyncImageDemo.xcodeproj
```
3. iOS 17+ のシミュレーターを選択
4. ビルドして実行 (⌘R)

プロジェクトは `SmartAsyncImage` へのローカル Swift Package 参照で事前設定されており、追加の設定なしで実行できます。

## 使い方

### クイックサンプル (SwiftUI)
```swift
import SwiftUI
import SmartAsyncImage

struct MinimalRemoteImageView: View {
let imageURL = URL(string: "https://picsum.photos/300")

var body: some View {

// 置き換え前: AsyncImage(url: imageURL) { phase in
// ------------------------------------------------
// 置き換え後:

SmartAsyncImage(url: imageURL) { phase in

// ------------------------------------------------

switch phase {
case .empty, .loading:
ProgressView()
case .success(let image):
image.resizable().scaledToFit()
case .failure:
Image(systemName: "photo")
}
}
.frame(width: 150, height: 150)
}
}
```

## 品質とツール

このプロジェクトは CI と静的解析によって品質ゲートを適用しています:

- **CI:** `main` へのすべてのコミットは GitHub Actions のチェックを通過する必要があります
- **静的解析:** DeepSource が `main` へのすべてのコミットで実行されます。
バッジは現在の未解決の静的解析問題の数を示しています。
- **テストカバレッジ:** Codecov が `main` ブランチのラインカバレッジをレポートします

<sub><strong>Codecov スナップショット</strong></sub><br/>
<a href="https://codecov.io/gh/gentle-giraffe-apps/SmartAsyncImage">
<img
src="https://codecov.io/gh/gentle-giraffe-apps/SmartAsyncImage/graphs/icicle.svg"
height="80"
alt="ファイルおよびモジュール別のコードカバレッジスナップショット (Codecov ツリーグラフ)"
/>
</a>

これらのチェックは、設計システムが安全に進化し続けられるようにすることを目的としています。

---

## アーキテクチャ

```mermaid
flowchart TD
SAI["SmartAsyncImage<br/>(SwiftUI View)"] --> VM["SmartAsyncImage<br/>ViewModel"]
VM --> Phase["SmartAsyncImage<br/>Phase"]
VM --> MemProto["SmartAsyncImageMemory<br/>CacheProtocol"]
MemProto --> Mem["SmartAsyncImage<br/>MemoryCache<br/>(actor)"]
Mem --> Disk["SmartAsyncImage<br/>DiskCache"]
Disk --> Encoder["SmartAsyncImage<br/>Encoder"]
Mem --> URLSession[["URLSession"]]
```

---

## 🤖 ツールに関する注記

このリポジトリの草稿作成および編集の一部は、大規模言語モデル (ChatGPT、Claude、Gemini を含む) を使用して加速されましたが、人間による直接的な設計、検証、最終承認のもとで行われています。すべての技術的決定、コード、アーキテクチャ上の結論は、リポジトリメンテナーによって作成・検証されています。

---

## 🔐 ライセンス

MIT ライセンス
個人利用・商用利用ともに自由です。

---

## 👤 作者

**Jonathan Ritchey** により構築
Gentle Giraffe Apps
シニア iOS エンジニア --- Swift | SwiftUI | Concurrency

![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Fgentle-giraffe-apps%2FSmartAsyncImage)
Loading
Loading