Skip to content

Instantly share code, notes, and snippets.

@jerrypm
Last active April 29, 2022 02:45
Show Gist options
  • Select an option

  • Save jerrypm/f84f7a285c1f4fe610c0f6e834842c72 to your computer and use it in GitHub Desktop.

Select an option

Save jerrypm/f84f7a285c1f4fe610c0f6e834842c72 to your computer and use it in GitHub Desktop.
//Visit my blog http://scripttes.blogspot.com/
//IOS Template https://codecanyon.net/item/simple-qr-code-barcode-scanner-generate-ios-12-and-13/25018066
import Foundation
import UIKit
extension UIView {
func setGradientBackground(colorOne: UIColor, colorTwo: UIColor) {
let gradientLayer = CAGradientLayer()
gradientLayer.frame = bounds
gradientLayer.colors = [colorOne.cgColor, colorTwo.cgColor]
gradientLayer.locations = [0.0, 4.0]
layer.insertSublayer(gradientLayer, at: 0)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment