izziGradient

1.1.0

lightweight package called IzziGradient to simplify the use of gradients in Swift with UIKit. This tool is designed to make creating and customizing gradients both intuitive and efficient, providing developers with an easy way to enhance their app's visual appeal.
Desp0o/izziGradient

What's New

v1.1.0

2024-11-20T21:32:47Z

Full Changelog: Latest...v1.1.0

izziGradient

lightweight package called IzziGradient to simplify the use of gradients in Swift with UIKit. This tool is designed to make creating and customizing gradients both intuitive and efficient, providing developers with an easy way to enhance their app's visual appeal.

Reference

Linear Gradient

Parameter Type Description Defaults
gradientColors [UIColor] Array of colors to apply in the gradient. [ ]
colorLocations [NSNumber] Locations for each color in the gradient. [ ]
startPoint CGPoint Starting point for the gradient. x: 0.0, y: 0.0
endPoint CGPoint Ending point for the gradient. x: 0.0, y: 1.0
newColors [UIColor] The target colors for animation. [ ]
duration CFTimeInterval Duration of the animation. 3.0
repeatCount Float Number of animation repetitions. .infinity
autoReverse Bool reverses direction after completion. true

Radial Gradient

Parameter Type Description Defaults
gradientColors [UIColor] Array of colors to apply in the gradient. [ ]
centerPoint CGPoint Starting point for the gradient. x: 0.5, y: 0.5
radius CGFloat Ending point for the gradient. 100.0

How to use

Linear Gradient

import izziGradient

let gradientView = IzziLinearGradient()
gradientView.gradientColors = [UIColor.white, UIColor.black]
gradientView.colorLocations = [0.5, 0.5]
gradientView.startPoint = CGPoint(x: 0.0, y: 0.0)
gradientView.endPoint = CGPoint(x: 0.4, y: 1.0)

Animate Linear Gradient

import izziGradient

graDispatchQueue.main.asyncAfter(deadline: .now() + 2) {
gradientView.animateColors(to: [UIColor.green, UIColor.yellow], duration: 3.0)
}

Animate Linear Gradient Start/End points

DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
    gradientView.animatePoints(to: CGPoint(x: 1.0, y: 0.0), endPoint: CGPoint(x: 0.0, y: 1.0), duration: 3.0)
}

Radial Gradient

import izziGradient

let gradientView = IzziRadialGradient()
gradientView.gradientColors = [UIColor.white, UIColor.black]
gradientView.colorLocations = [0.0, 1.0]
gradientView.centerPoint = CGPoint(x: 0.5, y: 0.3)
gradientView.radius = 200

Description

  • Swift Tools 6.0.0
View More Packages from this Author

Dependencies

  • None
Last updated: Tue May 13 2025 06:28:23 GMT-0900 (Hawaii-Aleutian Daylight Time)