I have a CAGradientLayer inserted to the bottom of this small detail view that pops up at the bottom of the app. As you can see, I\'ve set the colors from white to clear, but th
The answers above such as:
UIColor.white.withAlphaComponent(0).cgColor
and
UIColor(white: 1.0, alpha: 0.0).cgColor
should work in terms of getting a portion of your gradient to be clear (rather than the gray that OP is referring to). However, if you're still seeing a transparent white when you should be seeing a clear color, make sure the backgroundColor
of the view to which you're applying the gradient is clear as well.
By default, that view's background color will likely be white (or a dark color if the device is in dark mode), so when you apply the gradient, the clear portion of it will be "blocked" by the view's backgroundColor
itself. Set that to clear and you should be good to go.