Components
Shimmerbutton
ShimmerButton Component in SwiftUI
Overview
ShimmerButton
is a SwiftUI component designed for creating buttons with a shimmering animation. It features customizable text size, background and text colors, border radius, and shimmer duration, offering flexibility for various use-cases.
Preview
![](https://www.swiftcn.lol/shimmerButton.gif)
Installation
Include the ShimmerButton.swift
file in your SwiftUI project. File Link
Properties
Required Properties
text: String
- The text displayed on the button.
Optional Properties
textSize: CGFloat
- The size of the text displayed. Default is20.0
.shimmerDuration: Double
- The duration of the shimmer animation. Default is3.0
.borderRadius: CGFloat
- The radius of the button’s corners. Default is30
.backgroundColor: Color
- The background color of the button. Default is.black
.textColor: Color
- The color of the text. Default is.white
.
Usage
Basic Usage
Here’s how you can use the ShimmerButton
component:
ShimmerButton(text: "Submit")
Custom Usage
Here’s how you can customize the ShimmerButton
component:
ShimmerButton(
text: "Submit",
textSize: 30,
shimmerDuration: 2.0,
borderRadius: 20,
backgroundColor: .black,
textColor: .white
)