2018-06-29 18:41:30 +02:00
|
|
|
//
|
|
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
@objc
|
2018-08-08 16:58:54 +02:00
|
|
|
public class OWSLayerView: UIView {
|
2018-06-29 18:41:30 +02:00
|
|
|
let layoutCallback: ((UIView) -> Void)
|
|
|
|
|
|
|
|
@objc
|
|
|
|
public required init(frame: CGRect, layoutCallback : @escaping (UIView) -> Void) {
|
|
|
|
self.layoutCallback = layoutCallback
|
|
|
|
super.init(frame: frame)
|
|
|
|
}
|
|
|
|
|
2018-08-08 16:58:54 +02:00
|
|
|
public required init?(coder aDecoder: NSCoder) {
|
2018-06-29 18:41:30 +02:00
|
|
|
self.layoutCallback = { _ in
|
|
|
|
}
|
|
|
|
super.init(coder: aDecoder)
|
|
|
|
}
|
|
|
|
|
2018-08-08 16:58:54 +02:00
|
|
|
public override var bounds: CGRect {
|
2018-06-29 18:41:30 +02:00
|
|
|
didSet {
|
|
|
|
layoutCallback(self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-08 16:58:54 +02:00
|
|
|
public override var frame: CGRect {
|
2018-06-29 18:41:30 +02:00
|
|
|
didSet {
|
|
|
|
layoutCallback(self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-08 16:58:54 +02:00
|
|
|
public override var center: CGPoint {
|
2018-06-29 18:41:30 +02:00
|
|
|
didSet {
|
|
|
|
layoutCallback(self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|