E600
Skip to content

tjdrhs90/swiftui-shimmer-loading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

0