mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
48 lines
955 B
Swift
48 lines
955 B
Swift
//
|
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
@objc
|
|
public class OWSLayerView: UIView {
|
|
@objc
|
|
public var layoutCallback: ((UIView) -> Void)
|
|
|
|
@objc
|
|
public init() {
|
|
self.layoutCallback = { (_) in
|
|
}
|
|
super.init(frame: .zero)
|
|
}
|
|
|
|
@objc
|
|
public init(frame: CGRect, layoutCallback : @escaping (UIView) -> Void) {
|
|
self.layoutCallback = layoutCallback
|
|
super.init(frame: frame)
|
|
}
|
|
|
|
public required init?(coder aDecoder: NSCoder) {
|
|
self.layoutCallback = { _ in
|
|
}
|
|
super.init(coder: aDecoder)
|
|
}
|
|
|
|
public override var bounds: CGRect {
|
|
didSet {
|
|
layoutCallback(self)
|
|
}
|
|
}
|
|
|
|
public override var frame: CGRect {
|
|
didSet {
|
|
layoutCallback(self)
|
|
}
|
|
}
|
|
|
|
public override var center: CGPoint {
|
|
didSet {
|
|
layoutCallback(self)
|
|
}
|
|
}
|
|
}
|