iOS/Sources/App/Utilities/InputAccessoryView.swift
mat1th 97834bfd5e
Update swift lint and format + appy fixes (#2585)
## Summary
Swift lint and swiftformat are outdated. This PR does update those +
applies the new formatting form swiftformat.
There is 1 swift file with a manual change:
`Sources/Vehicle/Templates/Areas/CarPlayAreasViewModel.swift`. This is
done because `swiftlint` did create the following swiftlint error:
`error: Cyclomatic Complexity Violation: Function should have complexity
10 or less; currently complexity is 11 (cyclomatic_complexity)`.

Because it does change a lot of files the question is if we want to
finetune the `swiftformat` rules.

## Screenshots
No user facing changes.

## Link to pull request in Documentation repository
NA

## Any other notes
NA
2024-02-22 13:06:39 +01:00

38 lines
1.2 KiB
Swift

import UIKit
class InputAccessoryView: UIView {
init() {
super.init(frame: .zero)
autoresizingMask.insert(.flexibleHeight)
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override var intrinsicContentSize: CGSize {
.init(width: UIView.noIntrinsicMetric, height: 0)
}
var contentView: UIView? {
willSet {
if let contentView, contentView != newValue, contentView.superview == self {
contentView.removeFromSuperview()
}
}
didSet {
if let contentView {
addSubview(contentView)
NSLayoutConstraint.activate([
contentView.leadingAnchor.constraint(equalTo: layoutMarginsGuide.leadingAnchor),
contentView.trailingAnchor.constraint(equalTo: layoutMarginsGuide.trailingAnchor),
contentView.topAnchor.constraint(equalTo: layoutMarginsGuide.topAnchor),
contentView.bottomAnchor.constraint(equalTo: layoutMarginsGuide.bottomAnchor),
])
}
}
}
}