9893d5408a
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
24 lines
688 B
Swift
24 lines
688 B
Swift
import UIKit
|
|
|
|
final class HairlineView: UIView {
|
|
private var heightConstraint: NSLayoutConstraint?
|
|
|
|
override init(frame: CGRect) {
|
|
super.init(frame: frame)
|
|
backgroundColor = .separator
|
|
translatesAutoresizingMaskIntoConstraints = false
|
|
let constraint = heightAnchor.constraint(equalToConstant: 0.5)
|
|
constraint.isActive = true
|
|
heightConstraint = constraint
|
|
}
|
|
|
|
@available(*, unavailable)
|
|
required init?(coder: NSCoder) { fatalError() }
|
|
|
|
override func didMoveToWindow() {
|
|
super.didMoveToWindow()
|
|
let scale = window?.windowScene?.screen.scale ?? 2
|
|
heightConstraint?.constant = 1.0 / scale
|
|
}
|
|
}
|