ShimmerView is a SwiftUI implementation of Facebook shimmering effect. It's implemented as a SwiftUI view modifier allowing developers to add shimmering effect to any of SwiftUI View in a single line.
- Xcode 11
- Swift 5.1
- iOS 13 or higher.
Select the project in Navigator, go to the Swift Packages tab and add the following url
https://github.com/Vidhyadharan-Mohanram/ShimmerView
Shimmer effect can to added to any view by adding the view modifier to the view, the simmer view modifier takes an boolean value isActive to display or hide shimmering effect.
import ShimmerView
struct MainView : View {
var body: some View {
Text("Hello World")
.shimmer(isActive: shouldShimmer)
.padding()
}.environmentObject(ShimmerConfig())
}
ShimmerConfig
supports the following customizations
// color of the background view. Default is #c8c8c8
public var bgColor: Color
// color of the foreground view. Default is Color.white
public var fgColor: Color
- Shimmers when active causes the simulator and mac OS to stutter. Run the example app in device to prevent stuttering.
For the Side Menu go to https://github.com/Vidhyadharan-Mohanram/SideMenu
for more details.