简体   繁体   中英

Use of module 'CALayer' as a type

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

in ITSwitch.m

@property (readonly, strong) CALayer *rootLayer;

so in swift I write:

var rootLayer:CALayer?

but code give me this error:

Use of module 'CALayer' as a type

What's the error mean? How can I solve this?

If you add import QuartzCore at the top of your .swift file, the error will go away. The error message itself seems like a bit of a bug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM