Skip to content

arindam94/imageloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyImageLoader

MyImageLoader is a lightweight Swift Package for downloading and caching images in SwiftUI.
It provides both in-memory and disk caching, so images persist even after app relaunch.


Features

  • ✅ Asynchronous image downloading
  • ✅ Memory + Disk caching support
  • ✅ SwiftUI-friendly CachedAsyncImage view
  • ✅ Configurable placeholder and custom rendering
  • ✅ Minimal, dependency-free, and written in Swift

Requirements

  • iOS 14.0+
  • Swift 5.5+
  • Xcode 13.0+

Installation

Swift Package Manager

  1. Open your Xcode project
  2. Go to File > Add Packages
  3. Enter the repository URL:
https://github.com/arindam94/imageloader.git
  1. Select Add Package

Usage

Basic Example

import SwiftUI
import MyImageLoader

struct ContentView: View {
    var body: some View {
        VStack {
            CachedAsyncImage(
                url: URL(string: "https://picsum.photos/300"),
                placeholder: { ProgressView() },
                image: { Image(uiImage: $0).resizable() }
            )
            .frame(width: 200, height: 200)
            .clipShape(RoundedRectangle(cornerRadius: 16))
        }
    }
}

Advanced Example (With Styling)

CachedAsyncImage(
    url: URL(string: "https://example.com/avatar.png"),
    placeholder: {
        ZStack {
            Color.gray.opacity(0.2)
            ProgressView().progressViewStyle(CircularProgressViewStyle())
        }
    },
    image: { img in
        Image(uiImage: img)
            .resizable()
            .scaledToFill()
    }
)
.frame(width: 100, height: 100)
.clipShape(Circle())
.shadow(radius: 5)

Caching

  • Memory Cache: Temporary, cleared when app is terminated
  • Disk Cache: Persists images even after app relaunch

Both caches are automatically managed by the package.


License

Copyright © 2025 Arindam Santra.
All rights reserved. Unauthorized copying, modification, distribution, or use of this software without explicit permission is strictly prohibited.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages