Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift: How can a superlayer have no sublayers?

Tags:

ios

swift

enter image description here console output

How can a superlayer have no sublayers? Please see image above.

This is Xcode 6.3.

like image 994
johnnyMac Avatar asked Nov 10 '22 15:11

johnnyMac


1 Answers

As discussed in the comments, one case where a layer could be a superlayer but not have sublayers is when it has a mask.

let layer = CALayer()
let mask = CALayer()
layer.mask = mask

Now mask.superlayer is layer, but layer.sublayers is nil.

like image 147
Léo Natan Avatar answered Nov 15 '22 04:11

Léo Natan