### CocoaPods Installation Source: https://github.com/raymondjavaxx/smoothgradient/blob/main/README.md Instructions for adding the SmoothGradient framework to your project using CocoaPods, by adding the specified line to your Podfile. ```ruby pod 'SmoothGradient', '~> 1.0.0' ``` -------------------------------- ### Swift Package Manager Installation Source: https://github.com/raymondjavaxx/smoothgradient/blob/main/README.md Instructions for adding the SmoothGradient framework to your project using Swift Package Manager, compatible with both Package.swift and Xcode. ```swift .package(url: "https://github.com/raymondjavaxx/SmoothGradient.git", from: "1.0.0") ``` -------------------------------- ### Gradient.smooth() Extension Examples (Pre-iOS 17) Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Shows how to use the `Gradient.smooth()` static method for creating smooth gradients compatible with iOS 14-16. This extension is used with the standard `LinearGradient` view and employs `CubicBezierCurve` for easing, offering backward compatibility. ```swift import SwiftUI import SmoothGradient // Basic usage with LinearGradient struct LegacyGradientView: View { var body: some View { LinearGradient( gradient: .smooth( from: .black, to: .white, easing: .easeInOut ), startPoint: .top, endPoint: .bottom ) .frame(height: 200) } } // Fade overlay for images (pre-iOS 17) struct LegacyFadeView: View { var body: some View { VStack { LinearGradient( gradient: .smooth( from: .black, to: .black.opacity(0), easing: .easeInOut ), startPoint: .top, endPoint: .bottom ) .frame(height: 200) Spacer() } .background(Color.white) } } // Custom step count for smoother gradients struct HighQualityGradientView: View { var body: some View { LinearGradient( gradient: .smooth( from: .blue, to: .purple, easing: .easeOut, steps: 32 ), startPoint: .leading, endPoint: .trailing ) } } ``` -------------------------------- ### Install SmoothGradient via Package Manager Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Provides the configuration required to add the SmoothGradient dependency to your Swift project using Swift Package Manager or CocoaPods. ```swift dependencies: [ .package(url: "https://github.com/raymondjavaxx/SmoothGradient.git", from: "1.0.0") ] ``` -------------------------------- ### SmoothLinearGradient with Gradient.Stop Examples (iOS 17+) Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Illustrates how to create gradients with custom color stop locations using `Gradient.Stop` for partial gradients or fade effects. This allows for precise control over color placement within the gradient, suitable for effects like fading overlays. ```swift import SwiftUI import SmoothGradient // Fade effect - solid black to transparent struct FadeOverlayView: View { var body: some View { ZStack { Image("background") .resizable() .scaledToFill() SmoothLinearGradient( from: .init(color: .black, location: 0), to: .init(color: .black.opacity(0), location: 0.75), startPoint: .top, endPoint: .bottom, curve: .easeInOut ) } .ignoresSafeArea() } } // Partial gradient with custom stop locations struct PartialGradientView: View { var body: some View { SmoothLinearGradient( from: Gradient.Stop(color: .red, location: 0.2), to: Gradient.Stop(color: .yellow, location: 0.8), startPoint: .leading, endPoint: .trailing, curve: .easeIn ) } } ``` -------------------------------- ### SmoothLinearGradient View Examples (iOS 17+) Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Demonstrates the usage of the `SmoothLinearGradient` view for creating smooth linear gradients with configurable direction, easing curve, and interpolation steps. This view is compatible with iOS 17+ and conforms to both `ShapeStyle` and `View` protocols. ```swift import SwiftUI import SmoothGradient // Basic vertical gradient from black to white struct BasicGradientView: View { var body: some View { SmoothLinearGradient( from: .black, to: .white, startPoint: .top, endPoint: .bottom, curve: .easeInOut ) .frame(height: 300) } } // Horizontal gradient with custom colors struct HorizontalGradientView: View { var body: some View { SmoothLinearGradient( from: .green, to: .blue, startPoint: .leading, endPoint: .trailing, curve: .easeInOut ) .ignoresSafeArea() } } // Diagonal gradient with more interpolation steps for smoother result struct DiagonalGradientView: View { var body: some View { SmoothLinearGradient( from: .purple, to: .orange, startPoint: .topLeading, endPoint: .bottomTrailing, curve: .easeOut, steps: 32 // More steps for smoother gradient ) } } ``` -------------------------------- ### Implement Cubic Bezier Easing Curves Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Shows how to apply built-in easing curves like easeIn, easeOut, and easeInOut to gradients. It also demonstrates creating custom easing curves using control points for precise interpolation control. ```swift import SwiftUI import SmoothGradient struct CustomCurveView: View { var body: some View { let customCurve = CubicBezierCurve( p1: UnitPoint(x: 0.25, y: 0.1), p2: UnitPoint(x: 0.25, y: 1.0) ) return LinearGradient( gradient: .smooth( from: .indigo, to: .mint, easing: customCurve, steps: 20 ), startPoint: .top, endPoint: .bottom ) } } ``` -------------------------------- ### Smooth Gradient Usage (Pre-iOS 17/macOS 14) Source: https://github.com/raymondjavaxx/smoothgradient/blob/main/README.md Demonstrates how to create a smooth gradient using the LinearGradient initializer with the .smooth modifier for versions prior to iOS 17 and macOS 14. This method applies an easing curve to the gradient transition. ```swift import SmoothGradient struct ContentView: View { var body: some View { LinearGradient( gradient: .smooth(from: .black, to: .white, curve: .easeInOut), // ← startPoint: .top, endPoint: .bottom ) } } ``` -------------------------------- ### Create Gradients with Custom Stops (Pre-iOS 17) Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Demonstrates how to define custom color stops for gradients to achieve specific fade effects or partial coverage. This approach uses the Gradient.Stop type to specify exact locations for color transitions. ```swift import SwiftUI import SmoothGradient struct CustomStopsView: View { var body: some View { LinearGradient( gradient: .smooth( from: Gradient.Stop(color: .black, location: 0), to: Gradient.Stop(color: .clear, location: 0.6), easing: .easeInOut ), startPoint: .bottom, endPoint: .top ) } } ``` -------------------------------- ### SmoothGradient Usage (Pre-iOS 17) Source: https://github.com/raymondjavaxx/smoothgradient/blob/main/README.md How to implement smooth gradients using the .smooth extension on Gradient for older iOS/macOS versions. ```APIDOC ## .smooth(from:to:curve:) ### Description Creates a smooth gradient transition using an easing curve for older SwiftUI versions. ### Method Extension Method ### Parameters #### Arguments - **from** (Color) - Required - The starting color. - **to** (Color) - Required - The ending color. - **curve** (UnitCurve) - Required - The easing function to apply (e.g., .easeInOut). ### Request Example LinearGradient(gradient: .smooth(from: .black, to: .white, curve: .easeInOut), startPoint: .top, endPoint: .bottom) ### Response - **Gradient** (Object) - A configured SwiftUI Gradient object. ``` -------------------------------- ### Smooth Gradient Usage (iOS 17+/macOS 14+) Source: https://github.com/raymondjavaxx/smoothgradient/blob/main/README.md Shows how to implement smooth gradients using the dedicated SmoothLinearGradient view for iOS 17 and macOS 14 and later. This approach offers a more direct way to apply easing functions to gradients. ```swift import SmoothGradient struct ContentView: View { var body: some View { SmoothLinearGradient( // ← from: .black, to: .white, startPoint: .top, endPoint: .bottom, curve: .easeInOut ) } } ``` -------------------------------- ### Gradient.smooth() Extension (Pre-iOS 17) Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt A static extension for the standard SwiftUI Gradient type to provide smooth interpolation for older OS versions. ```APIDOC ## Gradient.smooth() ### Description Creates a smooth Gradient object compatible with iOS 14-16 using CubicBezierCurve easing. ### Parameters - **from** (Color) - Required - Starting color. - **to** (Color) - Required - Ending color. - **easing** (CubicBezierCurve) - Required - The easing curve to apply. - **steps** (Int) - Optional - Number of interpolation steps. ### Request Example LinearGradient(gradient: .smooth(from: .blue, to: .purple, easing: .easeOut, steps: 32), startPoint: .leading, endPoint: .trailing) ``` -------------------------------- ### SmoothLinearGradient Usage (iOS 17+) Source: https://github.com/raymondjavaxx/smoothgradient/blob/main/README.md How to implement smooth gradients using the dedicated SmoothLinearGradient view for modern iOS/macOS versions. ```APIDOC ## SmoothLinearGradient ### Description A dedicated view component for rendering smooth gradients in iOS 17+ and macOS 14+. ### Method View Initializer ### Parameters #### Arguments - **from** (Color) - Required - The starting color. - **to** (Color) - Required - The ending color. - **startPoint** (UnitPoint) - Required - The starting coordinate of the gradient. - **endPoint** (UnitPoint) - Required - The ending coordinate of the gradient. - **curve** (UnitCurve) - Required - The easing function to apply. ### Request Example SmoothLinearGradient(from: .black, to: .white, startPoint: .top, endPoint: .bottom, curve: .easeInOut) ### Response - **View** (Object) - A SwiftUI View representing the smooth gradient. ``` -------------------------------- ### Gradient.smooth() with Gradient.Stop Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Create gradients with custom color stop positions for partial coverage or fade effects, compatible with pre-iOS 17 versions. ```APIDOC ## Gradient.smooth() with Gradient.Stop ### Description Creates a smooth gradient transition between two specific color stops with customizable easing and step resolution. ### Method Swift Function Call ### Parameters #### Request Body - **from** (Gradient.Stop) - Required - The starting color and location. - **to** (Gradient.Stop) - Required - The ending color and location. - **easing** (Easing) - Required - The interpolation curve (e.g., .easeInOut). - **steps** (Int) - Optional - Number of color steps to generate (default 24). ### Request Example Gradient.smooth(from: Gradient.Stop(color: .black, location: 0), to: Gradient.Stop(color: .clear, location: 0.6), easing: .easeInOut) ``` -------------------------------- ### SmoothLinearGradient (iOS 17+) Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Utilize native UnitCurve easing for gradients on iOS 17 and macOS 14+. ```APIDOC ## SmoothLinearGradient ### Description Native SwiftUI-integrated gradient component using UnitCurve for modern iOS versions. ### Parameters #### Request Body - **from** (Color) - Required - Start color. - **to** (Color) - Required - End color. - **startPoint** (UnitPoint) - Required - Gradient start position. - **endPoint** (UnitPoint) - Required - Gradient end position. - **curve** (UnitCurve) - Required - The easing curve to apply. ### Request Example SmoothLinearGradient(from: .cyan, to: .blue, startPoint: .top, endPoint: .bottom, curve: .easeIn) ``` -------------------------------- ### Use Native UnitCurve Easing (iOS 17+) Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Utilizes SwiftUI's native UnitCurve for modern iOS versions. This method provides better system integration and supports standard easing curves as well as custom bezier curves. ```swift import SwiftUI import SmoothGradient @available(iOS 17.0, macOS 14.0, *) struct ModernEasingView: View { var body: some View { SmoothLinearGradient( from: .cyan, to: .blue, startPoint: .top, endPoint: .bottom, curve: .bezier(startControlPoint: .init(x: 0.4, y: 0), endControlPoint: .init(x: 0.6, y: 1)) ) } } ``` -------------------------------- ### CubicBezierCurve Easing Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt Define custom interpolation curves using cubic bezier control points for smooth gradient transitions. ```APIDOC ## CubicBezierCurve ### Description Defines a custom easing curve using two control points to manipulate the gradient interpolation speed. ### Parameters #### Request Body - **p1** (UnitPoint) - Required - First control point. - **p2** (UnitPoint) - Required - Second control point. ### Request Example CubicBezierCurve(p1: UnitPoint(x: 0.25, y: 0.1), p2: UnitPoint(x: 0.25, y: 1.0)) ``` -------------------------------- ### SmoothLinearGradient (iOS 17+) Source: https://context7.com/raymondjavaxx/smoothgradient/llms.txt The primary view for creating smooth linear gradients in iOS 17 and later, supporting custom easing curves and interpolation steps. ```APIDOC ## SmoothLinearGradient ### Description A SwiftUI view and shape style that renders a smooth linear gradient between two colors using native UnitCurve easing functions. ### Parameters #### Initializers - **from** (Color/Gradient.Stop) - Required - The starting color or stop. - **to** (Color/Gradient.Stop) - Required - The ending color or stop. - **startPoint** (UnitPoint) - Required - The starting coordinate of the gradient. - **endPoint** (UnitPoint) - Required - The ending coordinate of the gradient. - **curve** (UnitCurve) - Required - The easing function to apply. - **steps** (Int) - Optional - Number of interpolation steps (default: 16). ### Request Example SmoothLinearGradient(from: .black, to: .white, startPoint: .top, endPoint: .bottom, curve: .easeInOut, steps: 32) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.