Fix doc comment typo
Shimmer is a super-light modifier that adds a shimmering effect to any SwiftUI View, for example, to show that an operation is in progress. It works well on light and dark modes, and across iOS, macOS, tvOS and watchOS.
Shimmer
View
import SwiftUI import Shimmer ⋮ ⋮ Text("SwiftUI Shimmer").modifier(Shimmer())
or more conveniently
Text("SwiftUI Shimmer").shimmering()
active
true
duration
1.5
bounce
false
delay
0
You can now provide a custom animation:
Text("Loading...") .shimmering( active: isAnimating, animation: .easeInOut(duration: 2).repeatCount(5, autoreverses: false).delay(1) )
Of course, you can combine .shimmering(...) with the .redacted(...) modifier to create interesting animated skeleton views.
.shimmering(...)
.redacted(...)
Text("Some text") .redacted(reason: .placeholder) .shimmering()
The mask and animation now adjusts automatically to the environment’s layoutDirection in order to better support different languages and locales.
layoutDirection
Use the package URL or search for the SwiftUI-Shimmer package: https://github.com/markiv/SwiftUI-Shimmer.
For how-to integrate package dependencies refer to Adding Package Dependencies to Your App documentation.
Add this to your Podfile:
pod 'SwiftUI-Shimmer', :git => 'https://github.com/markiv/SwiftUI-Shimmer.git'
For an older, UIKit-based shimmer effect, see UIView-Shimmer.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
SwiftUI-Shimmer ✨
Shimmer
is a super-light modifier that adds a shimmering effect to any SwiftUIView
, for example, to show that an operation is in progress. It works well on light and dark modes, and across iOS, macOS, tvOS and watchOS.or more conveniently
Optional Parameters ⚙️
active
: Convenience parameter to conditionally enable the effect. Defaults totrue
.duration
: The duration of a shimmer cycle in seconds. Default:1.5
.bounce
: Whether to bounce (reverse) the animation back and forth. Defaults tofalse
.delay
: A delay in seconds. Defaults to0
.Custom Animation
You can now provide a custom animation:
Animated Skeletons ☠️
Of course, you can combine
.shimmering(...)
with the.redacted(...)
modifier to create interesting animated skeleton views.Right-To-Left (RTL) Support
The mask and animation now adjusts automatically to the environment’s
layoutDirection
in order to better support different languages and locales.Installation
Swift Package Manager
Use the package URL or search for the SwiftUI-Shimmer package: https://github.com/markiv/SwiftUI-Shimmer.
For how-to integrate package dependencies refer to Adding Package Dependencies to Your App documentation.
Cocoapods
Add this to your Podfile:
What About UIKit?
For an older, UIKit-based shimmer effect, see UIView-Shimmer.