A concise, runnable SwiftUI example of loading remote images with AsyncImage.
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.
AsyncImageremote 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
Constantsenum.
git clone https://github.com/ahmetbostanciklioglu/AsyncImageDownloadingSwiftUI.git
cd AsyncImageDownloadingSwiftUI
open ImageDownloadingSwiftUI.xcodeprojThen open ImageDownloadingSwiftUI.xcodeproj in Xcode, select a simulator, and press ⌘R to build and run.
- iOS 15.6+ (
AsyncImagerequires iOS 15 or later) - Xcode 15+ (project created with Xcode 26)
- Swift 5
Ahmet Bostancıklıoğlu — @ahmetbostanciklioglu · ahmetbostancikli@gmail.com
⭐ If this helped you, consider giving the repo a star!



