iOS: fix AVRoutePickerView hierarchy warning by using UIViewControllerRepresentable
Some checks failed
CI / UI / Build (pull_request) Failing after 6s
CI / Scraper / Test (pull_request) Failing after 9s
CI / Scraper / Lint (pull_request) Failing after 10s
CI / Scraper / Build (pull_request) Has been skipped
iOS CI / Build (push) Has been cancelled
iOS CI / Test (push) Has been cancelled
iOS CI / Build (pull_request) Failing after 2s
iOS CI / Test (pull_request) Has been skipped
Some checks failed
CI / UI / Build (pull_request) Failing after 6s
CI / Scraper / Test (pull_request) Failing after 9s
CI / Scraper / Lint (pull_request) Failing after 10s
CI / Scraper / Build (pull_request) Has been skipped
iOS CI / Build (push) Has been cancelled
iOS CI / Test (push) Has been cancelled
iOS CI / Build (pull_request) Failing after 2s
iOS CI / Test (pull_request) Has been skipped
This commit is contained in:
@@ -571,16 +571,28 @@ struct FullPlayerView: View {
|
||||
|
||||
// MARK: - AirPlay Button
|
||||
|
||||
struct AirPlayButton: UIViewRepresentable {
|
||||
func makeUIView(context: Context) -> AVRoutePickerView {
|
||||
struct AirPlayButton: UIViewControllerRepresentable {
|
||||
func makeUIViewController(context: Context) -> UIViewController {
|
||||
let vc = UIViewController()
|
||||
vc.view.backgroundColor = .clear
|
||||
|
||||
let picker = AVRoutePickerView()
|
||||
picker.tintColor = UIColor.white.withAlphaComponent(0.7)
|
||||
picker.activeTintColor = UIColor(named: "AccentColor") ?? UIColor.systemOrange
|
||||
picker.prioritizesVideoDevices = false
|
||||
return picker
|
||||
picker.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
||||
vc.view.addSubview(picker)
|
||||
NSLayoutConstraint.activate([
|
||||
picker.leadingAnchor.constraint(equalTo: vc.view.leadingAnchor),
|
||||
picker.trailingAnchor.constraint(equalTo: vc.view.trailingAnchor),
|
||||
picker.topAnchor.constraint(equalTo: vc.view.topAnchor),
|
||||
picker.bottomAnchor.constraint(equalTo: vc.view.bottomAnchor),
|
||||
])
|
||||
return vc
|
||||
}
|
||||
|
||||
func updateUIView(_ uiView: AVRoutePickerView, context: Context) {}
|
||||
func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
|
||||
}
|
||||
|
||||
// MARK: - Sleep Timer Sheet
|
||||
|
||||
Reference in New Issue
Block a user