A SwiftUI framework for creating smooth gradients using easing functions.
Linear gradients tend to produce hard edges, which are more noticeable when transitioning between highly contrasting colors. This framework provides a simple way to create smoother gradients using easing functions.
| Linear | Smooth |
|---|---|
| Linear Gradient | Smooth Gradient |
Add the following to your Package.swift file:
.package(url: "https://github.com/raymondjavaxx/SmoothGradient.git", from: "1.0.0")
To add from Xcode, go to File -> Add Package Dependencies... and enter the URL above.
Add the following to your Podfile:
pod 'SmoothGradient', '~> 1.0.0'
import SmoothGradient struct ContentView: View { var body: some View { LinearGradient( gradient: .smooth(from: .black, to: .white, curve: .easeInOut), // ⬅️ startPoint: .top, endPoint: .bottom ) } }
import SmoothGradient struct ContentView: View { var body: some View { SmoothLinearGradient( // ⬅️ from: .black, to: .white, startPoint: .top, endPoint: .bottom, curve: .easeInOut ) } }
SmoothGradient is available under the MIT license. See the LICENSE file for more info.