Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of module 'CALayer' as a type

Tags:

swift

calayer

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?

like image 520
galilio Avatar asked Jun 17 '14 01:06

galilio


1 Answers

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.

like image 88
Nate Cook Avatar answered Nov 22 '22 19:11

Nate Cook