A customizable animated gradient text label SDK for iOS.
✨ Multiple Gradient Directions - Left to Right, Right to Left, Top to Bottom, Bottom to Top
🎬 Smooth Animations - Seamless infinite loop animations
🎨 Customizable Colors - Set any colors you want
⚙️ Easy Configuration - Simple builder pattern API
// Animated gradient text with smooth infinite loop
let label = GradientTextLabel.create()
.setText("GRADIENT")
.setColors([.systemGreen, .systemBlue])
.setAnimated(true)- In Xcode, select
File→Add Package Dependencies... - Enter the repository URL:
https://github.com/woolnd/GradientFlow
- Select the version and add to your project
Add the following to your Package.swift:
dependencies: [
.package(url: "https://github.com/YOUR_USERNAME/GradientFlow", from: "1.0.0")
]import GradientFlow
let gradientLabel = GradientTextLabel()
gradientLabel.text = "Hello World"
gradientLabel.fontSize = 32
gradientLabel.colors = [.systemBlue, .systemPurple]
view.addSubview(gradientLabel)
gradientLabel.frame = CGRect(x: 40, y: 250, width: 300, height: 90)let label = GradientTextLabel.create()
.setText("Gradient Text")
.setFontSize(28)
.setColors([
UIColor(red: 0.2, green: 0.8, blue: 0.5, alpha: 1.0),
UIColor(red: 0.2, green: 0.6, blue: 1.0, alpha: 1.0)
])
.setGradientDirection(.leftToRight)
.setAnimated(true)
.setAnimationDirection(.leftToRight)
.setAnimationDuration(3.0)
view.addSubview(label)Set the direction of the gradient:
label.gradientDirection = .leftToRight // Left → Right
label.gradientDirection = .rightToLeft // Right → Left
label.gradientDirection = .topToBottom // Top → Bottom
label.gradientDirection = .bottomToTop // Bottom → TopControl animation settings:
// Enable/disable animation
label.isAnimated = true
// Animation direction
label.animationDirection = .leftToRight // Left → Right
label.animationDirection = .rightToLeft // Right → Left
label.animationDirection = .topToBottom // Top → Bottom
label.animationDirection = .bottomToTop // Bottom → Top
// Animation speed (in seconds)
label.animationDuration = 4.0Customize gradient colors:
// Two-color gradient
label.colors = [.red, .blue]
// Multi-color gradient
label.colors = [.red, .yellow, .green, .blue]
// Custom colors
label.colors = [
UIColor(red: 0.2, green: 0.8, blue: 0.5, alpha: 1.0),
UIColor(red: 0.2, green: 0.6, blue: 1.0, alpha: 1.0)
]Customize text appearance:
label.text = "Your Text"
label.fontSize = 24
label.fontWeight = .bold // .regular, .medium, .semibold, .heavylet staticLabel = GradientTextLabel.create()
.setText("Static Gradient")
.setFontSize(32)
.setColors([.systemPink, .systemOrange])
.setGradientDirection(.topToBottom)
.setAnimated(false)let animatedLabel = GradientTextLabel.create()
.setText("Animated Gradient")
.setFontSize(28)
.setColors([.systemTeal, .systemBlue, .systemPurple])
.setAnimated(true)
.setAnimationDirection(.leftToRight)
.setAnimationDuration(3.5)let verticalLabel = GradientTextLabel.create()
.setText("Vertical Flow")
.setFontSize(24)
.setColors([.systemGreen, .systemYellow])
.setGradientDirection(.topToBottom)
.setAnimated(true)
.setAnimationDirection(.topToBottom)
.setAnimationDuration(5.0)| Property | Type | Default | Description |
|---|---|---|---|
text |
String |
"Gradient Text" |
The text to display |
fontSize |
CGFloat |
24 |
Font size in points |
fontWeight |
UIFont.Weight |
.bold |
Font weight |
colors |
[UIColor] |
Green & Blue | Gradient colors array |
gradientDirection |
GradientDirection |
.leftToRight |
Direction of gradient |
isAnimated |
Bool |
true |
Enable/disable animation |
animationDirection |
AnimationDirection |
.leftToRight |
Direction of animation |
animationDuration |
TimeInterval |
4.0 |
Animation duration in seconds |
| Method | Description |
|---|---|
create() |
Creates a new instance |
setText(_:) |
Sets the text |
setFontSize(_:) |
Sets the font size |
setFontWeight(_:) |
Sets the font weight |
setColors(_:) |
Sets gradient colors |
setGradientDirection(_:) |
Sets gradient direction |
setAnimated(_:) |
Enables/disables animation |
setAnimationDirection(_:) |
Sets animation direction |
setAnimationDuration(_:) |
Sets animation duration |
- iOS 13.0+
- Swift 5.9+
- Xcode 15.0+
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
wodnd - GitHub
- Inspired by modern UI design trends
- Built with ❤️ for the iOS community