Skip to content

About

Add a shimmer / skeleton loading effect to any SwiftUI view

Topics

Resources

Stars

18 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

SwiftUI Shimmer Loading

Swift 5.9 iOS 15+ SPM License

Add a shimmer / skeleton loading effect to any SwiftUI view. One modifier. Zero dependencies.

Preview

Installation

https://github.com/tjdrhs90/swiftui-shimmer-loading.git

Usage

Basic

import ShimmerLoading

Text("Loading...")
    .shimmer()

Toggle On/Off

Text("Content")
    .shimmer(active: isLoading)

Skeleton Placeholder

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()

Custom Duration

Image("placeholder")
    .shimmer(duration: 2.0, bounce: true)

Customization

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

Requirements

  • iOS 15+
  • Swift 5.9+
  • Xcode 15+

License

MIT License. See LICENSE for details.

About

Add a shimmer / skeleton loading effect to any SwiftUI view

Topics

Resources

Stars

18 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages