Skip to content

ahmetbostanciklioglu/AsyncImageDownloadingSwiftUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🖼️ Async Image Downloading (SwiftUI)

A concise, runnable SwiftUI example of loading remote images with AsyncImage.

Platform Swift SwiftUI Xcode Stars Last Commit

📖 Overview

This project is a small SwiftUI learning example that demonstrates how to download and display a remote image using SwiftUI's built‑in AsyncImage view. While the image is loading, a system placeholder icon is shown; once the download completes, the image is rendered as a circular avatar. Tapping the loaded image swaps the URL, triggering a fresh download of a second image.

It follows a clean MVVM structure — the view state and image URLs live in an ObservableObject view model, keeping the views declarative and free of business logic.

✨ Features

  • AsyncImage remote loading — downloads an image from a URL with a placeholder shown during loading.
  • Placeholder view — an SF Symbol (person.circle.fill) rendered as a circular avatar while the image loads.
  • Tap to swap image — tapping the downloaded image updates the URL via the view model to load a different image.
  • MVVM separation — a ViewModel (ObservableObject) publishes the image URL and owns the image‑switching logic.
  • Centralized constants — placeholder name, size, and the secondary image URL are kept in a Constants enum.

📸 Preview

Screenshot 2025-12-05 at 00 47 34 Screenshot 2025-12-05 at 00 49 20 Screenshot 2025-12-05 at 00 49 27 Screenshot 2025-12-05 at 00 50 15

🚀 Getting Started

git clone https://github.com/ahmetbostanciklioglu/AsyncImageDownloadingSwiftUI.git
cd AsyncImageDownloadingSwiftUI
open ImageDownloadingSwiftUI.xcodeproj

Then open ImageDownloadingSwiftUI.xcodeproj in Xcode, select a simulator, and press ⌘R to build and run.

📋 Requirements

  • iOS 15.6+ (AsyncImage requires iOS 15 or later)
  • Xcode 15+ (project created with Xcode 26)
  • Swift 5

🧑‍💻 Author

Ahmet Bostancıklıoğlu@ahmetbostanciklioglu · ahmetbostancikli@gmail.com

⭐ If this helped you, consider giving the repo a star!

About

SwiftUI example demonstrating remote image loading with AsyncImage, a placeholder, and tap-to-swap using MVVM.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages