0

I'm trying to use the new conic gradient type. I've set the deployment target to 12.0 and added the QuartzCore framework, and I'm setting the type of a gradient to .conic:

    let gradient = CAGradientLayer()
    gradient.type = CAGradientLayerType.conic

I can even click through to the documentation:

extension CAGradientLayerType {
    ...

    /* Conic gradient. The gradient is centered at 'startPoint' and its 0-degrees
     * direction is defined by a vector spanned between 'startPoint' and
     * 'endPoint'. When 'startPoint' and 'endPoint' overlap the results are
     * undefined. The gradient's angle increases in the direction of rotation of
     * positive x-axis towards positive y-axis. */

    @available(iOS 12.0, *)
    public static let conic: CAGradientLayerType
}

but I'm still getting this build error:

Type 'CAGradientLayerType' (aka 'NSString') has no member 'conic'
rmp251
  • 5,018
  • 4
  • 34
  • 46

1 Answers1

0

Thanks to this answer looks like the issue was my swift language version (Target > Build Settings > Swift Language Version). It needs to be version 5 to use this syntax. Otherwise, I guess we would need to treat that property as a string, and set it to kCAGradientLayerConic.

rmp251
  • 5,018
  • 4
  • 34
  • 46