I have something like this in a UIView subclass:
override var bounds : CGRect {
didSet {
somelayer.frame = bounds
}
}
In the corresponding somelayer, I have this:
override var bounds: CGRect {
didSet {
someFunction()
}
}
Now if the view is initialized using super.init(frame: someFrame), the first block is not called. This appears to indicate that the bounds property is not set alongside frame.
If I change the first block to override var frame, then it will be called by super.init(frame: someFrame), and it will set the frame of somelayer. Interestingly, when that happens, the second block is called, suggesting that bounds and frame are set at the same time (which is what I'd expect, too).
Am I missing anything here?