Add a shimmer / skeleton loading effect to any SwiftUI view. One modifier. Zero dependencies.
https://github.com/tjdrhs90/swiftui-shimmer-loading.git
import ShimmerLoading
Text("Loading...")
.shimmer()Text("Content")
.shimmer(active: isLoading)import ShimmerLoading
// Built-in skeleton shapes
VStack(alignment: .leading, spacing: 12) {
SkeletonShape(height: 20) // Full width line
SkeletonShape(width: 200, height: 16) // Fixed width line
SkeletonShape(width: 150, height: 16) // Shorter line
}
.padding()Image("placeholder")
.shimmer(duration: 2.0, bounce: true)| Parameter | Type | Default | Description |
|---|---|---|---|
active |
Bool |
true |
Enable/disable the shimmer |
duration |
Double |
1.5 |
Animation duration in seconds |
bounce |
Bool |
false |
Bounce back instead of looping |
- iOS 15+
- Swift 5.9+
- Xcode 15+
MIT License. See LICENSE for details.