Swiftpack.co - robinlieb/GradientViewExtension as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by robinlieb.
robinlieb/GradientViewExtension 0.0.1
This package extends UIView to set a gradient background.
⭐️ 1
🕓 4 years ago
iOS
.package(url: "https://github.com/robinlieb/GradientViewExtension.git", from: "0.0.1")

GradientViewExtension

This package extends UIView to set a gradient background.

Getting Started

Installing

Swift Package Manager

To include GradientViewExtension into a Swift Package Manger package add the dependencies value in your Package.swift:

dependencies: [
    .package(url: "https://github.com/robinlieb/GradientViewExtension.git", from: "0.0.1")
]

CocoaPods

To include GradientViewExtension into your CocoaPods project add it into your Podfile:

pod 'GradientViewExtension', '~> 0.0.1'

Usage

By default the extension draws an axial gradient.

var view = UIView()
view.setGradientBackground(startColor: .black, endColor: .white)

You can also set the gradient type explicitly. Possible values are axial, radial and conic.

var view = UIView()
view.setGradientBackground(startColor: .black, endColor: .white, gradientType: .radial)

This extension can be used by all subclasses of UIView, i.g. UIButton:

var button = UIButton()
view.setGradientBackground(startColor: .black, endColor: .white)

Requirements

  • iOS 12.0+
  • Xcode 10.2+
  • Swift 5+

License

Licensed under MIT license, see LICENSE.

GitHub

link
Stars: 1
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics