Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import UIKit
class LayoutMarginsHackView: UIView {
var actualLayoutMargins: UIEdgeInsets = .zero
override var layoutMargins: UIEdgeInsets {
set {
if #available(iOS 11, *) {
super.layoutMargins = newValue
} else {
super.layoutMargins = actualLayoutMargins
}
}
get {
return super.layoutMargins
}
}
}
import UIKit
protocol LayoutMarginsDidChangeHackViewDelegate: class {
func viewLayoutMarginsDidChange()
}
class LayoutMarginsDidChangeHackView: UIView {
weak var delegate: LayoutMarginsDidChangeHackViewDelegate?
override func layoutMarginsDidChange() {
super.layoutMarginsDidChange()
if #available(iOS 11, *) {
// no-op
} else {
delegate?.viewLayoutMarginsDidChange()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.