It will not compile if you use CALayer.

The project code is correct, while you forgot to change it here in article
Merge pull request #28 from onevcat/master

It will not compile if you use CALayer.