I have something like this in a subclass UIView:
override var bounds : CGRect {
didSet {
somelayer.frame = bounds
}
}
In the corresponding somelayerI have the following:
override var bounds: CGRect {
didSet {
someFunction()
}
}
Now, if the view is initialized with super.init(frame: someFrame), the first block is not called. This indicates that the property is boundsnot set next to frame.
If I changed the first block to override var frame, then it will be called super.init(frame: someFrame)and it will set frameto somelayer. Interestingly, when this happens, the second block is called, assuming that boundsthey frameare installed at the same time (which I expect).
Am I missing something?
source
share