Using the CALayer Module as a Type

I want to pass ITSwitch from obj-c to swift. https://github.com/iluuu1994/ITSwitch.git

at ITSwitch.m

@property (readonly, strong) CALayer *rootLayer; 

therefore, in a quick entry, I write:

 var rootLayer:CALayer? 

but the code gives me this error:

 Use of module 'CALayer' as a type 

What does the error mean? How can i solve this?

+7
swift calayer
source share
1 answer

If you add import QuartzCore to the top of your .swift file, the error will disappear. The error message itself seems a little error.

+14
source share

All Articles