https://github.com/anbalagand/photoviewer
Load image asynchronously and stored in InMemory cache. It will help you to reduce overall network traffic, image loading time and improve the app responsive time
https://github.com/anbalagand/photoviewer
asyncimage cache inmemory-cache ios swift swiftui
Last synced: 5 months ago
JSON representation
Load image asynchronously and stored in InMemory cache. It will help you to reduce overall network traffic, image loading time and improve the app responsive time
- Host: GitHub
- URL: https://github.com/anbalagand/photoviewer
- Owner: AnbalaganD
- Created: 2023-09-30T19:29:22.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-05T09:07:19.000Z (about 1 year ago)
- Last Synced: 2025-04-28T12:45:48.346Z (about 1 year ago)
- Topics: asyncimage, cache, inmemory-cache, ios, swift, swiftui
- Language: Swift
- Homepage:
- Size: 178 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PhotoViewer
A SwiftUI-based iOS app that displays photos from [JSONPlaceholder API](https://jsonplaceholder.typicode.com) with smart caching and compression.
## Features
- 📱 Browse 5,000 photos in a smooth, scrollable list
- 🔍 View photo details with editable titles
- 💾 Intelligent LRU cache with Brotli compression
- 🚀 Async/await networking with proper error handling
- ⚡ Memory pressure monitoring and auto-cleanup
- ✅ Unit tested cache implementation
## Tech Stack
- **UI**: SwiftUI with NavigationStack
- **Architecture**: MVVM pattern
- **Networking**: URLSession with async/await
- **Caching**: Custom LRU cache with linked list
- **Compression**: Brotli algorithm for optimal storage
- **Concurrency**: Swift Concurrency (`@Sendable`, `@MainActor`)
## Requirements
- **Xcode**: 15.0+
- **iOS**: 15.0+
## Getting Started
1. Clone the repository
2. Open `PhotoViewer.xcodeproj` in Xcode
3. Select a simulator or device
4. Run the project (`Cmd + R`)
## Architecture Highlights
- **Protocol-driven design** for testability and flexibility
- **Automatic memory management** with cache eviction on memory pressure
- **Image compression** reduces memory footprint by ~60-80%
- **Dependency injection** for easy testing and mocking