How to do Gradient background colors in Swift ?
Hello folks Leo here,
Quick tip from what I learned today.
The code below make the background from white to yellowish.
self here is the element that you want to have a gradient background
let colorTop = UIColor.white.cgColor let colorBottom = UIColor(red: 0.941 , green: 0.818, blue: .zero, alpha: 1.0).cgColor let gradientLayer = CAGradientLayer() gradientLayer.frame = self.bounds gradientLayer.colors = [colorTop, colorBottom] self.layer.insertSublayer(gradientLayer, at: 0)
Thanks for reading!
It looks interesting. I was very curious, how much toner will it take to print such a test image in CMYK? I'm thinking of trying it on my Brother printer. I still buy toner cheap on the site https://www.mrdepot.ca/products/brother-mfc-7860dw-toner , so I'm not afraid to spend a little bit on printing such a gradient. Both beautiful and practical.