Files
yattee/Shared/Player/PlayerLayerView.swift
Arkadiusz Fal 5758417293 Fix SwiftLint and SwiftFormat violations
- Run SwiftFormat to fix indentation, spacing, and formatting issues
- Replace CGFloat with Double and NSRect with CGRect per style guide
- Remove redundant .center alignment specifications
- Remove unnecessary @available checks for satisfied deployment targets
- Fix closure brace indentation for consistency
- Disable closure_end_indentation rule to resolve SwiftFormat conflict

All linting checks now pass with zero errors and warnings.
2025-11-15 19:42:37 +01:00

54 lines
1.3 KiB
Swift

import AVFoundation
import Foundation
#if os(macOS)
import AppKit
#else
import UIKit
#endif
#if os(macOS)
final class PlayerLayerView: NSView {
var player = PlayerModel.shared { didSet {
wantsLayer = true
}}
override func makeBackingLayer() -> CALayer {
player.avPlayerBackend.playerLayer
}
override init(frame frameRect: CGRect) {
super.init(frame: frameRect)
wantsLayer = true
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
}
#else
final class PlayerLayerView: UIView {
var player: PlayerModel { .shared }
private var layerAdded = false
// swiftlint:disable:next unneeded_override
override init(frame: CGRect) {
super.init(frame: frame)
}
@available(*, unavailable)
required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
if !layerAdded {
layerAdded = true
layer.addSublayer(player.avPlayerBackend.playerLayer)
}
player.avPlayerBackend.playerLayer.frame = bounds
super.layoutSubviews()
}
}
#endif