Skip to content

DagAgren/GradientView

Repository files navigation

GradientView

A simple gradient view for iOS that wraps CAGradientLayer in a better API.

Overview

CAGradientLayer is a very powerful tool for displaying gradients in iOS apps, but it can be difficult to configure correctly, especially for radial gradients. GradientView attempts to provide a more accessible API for it, while also wrapping it in a UIView, and handling dark and light mode changes, which CAGradientLayer does not do as it uses CGColor which is unaware of interface style changes.

Documentation

The code is documented with DocC, and the formatted documentation is available at https://dagagren.github.io/GradientView/documentation/gradientview.

How to use

You can use this repo as a Swift Package Manager package:

.package(url: "https://github.com/apple/swift-docc-plugin", exact: "1.0.0")

Or you can simply copy the GradientView.swift file into your project, it is the only file that is needed.

License

This code is released into the public domain with no warranties. If that is not suitable, it is also available under the CC0 license.

About

Simple gradient view for iOS that wraps CAGradientLayer in a better API

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages