You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
session-ios/SignalUtilitiesKit/Shared Views/OWSLayerView.swift

49 lines
955 B
Swift

6 years ago
//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
6 years ago
//
import Foundation
@objc
6 years ago
public class OWSLayerView: UIView {
@objc
6 years ago
public var layoutCallback: ((UIView) -> Void)
6 years ago
@objc
6 years ago
public init() {
self.layoutCallback = { (_) in
}
super.init(frame: .zero)
}
@objc
public init(frame: CGRect, layoutCallback : @escaping (UIView) -> Void) {
6 years ago
self.layoutCallback = layoutCallback
super.init(frame: frame)
}
6 years ago
public required init?(coder aDecoder: NSCoder) {
6 years ago
self.layoutCallback = { _ in
}
super.init(coder: aDecoder)
}
6 years ago
public override var bounds: CGRect {
6 years ago
didSet {
layoutCallback(self)
}
}
6 years ago
public override var frame: CGRect {
6 years ago
didSet {
layoutCallback(self)
}
}
6 years ago
public override var center: CGPoint {
6 years ago
didSet {
layoutCallback(self)
}
}
}