2022-06-18 12:39:49 +00:00
|
|
|
import Foundation
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
struct ControlBackgroundModifier: ViewModifier {
|
|
|
|
var enabled = true
|
|
|
|
var edgesIgnoringSafeArea = Edge.Set()
|
|
|
|
|
|
|
|
func body(content: Content) -> some View {
|
|
|
|
if enabled {
|
2022-08-06 13:26:59 +00:00
|
|
|
if #available(iOS 15, macOS 12, *) {
|
|
|
|
content
|
|
|
|
.background(.thinMaterial)
|
|
|
|
} else {
|
|
|
|
content
|
|
|
|
#if os(macOS)
|
|
|
|
.background(VisualEffectBlur(material: .hudWindow))
|
|
|
|
#elseif os(iOS)
|
|
|
|
.background(VisualEffectBlur(blurStyle: .systemThinMaterial).edgesIgnoringSafeArea(edgesIgnoringSafeArea))
|
|
|
|
#else
|
|
|
|
.background(.thinMaterial)
|
|
|
|
#endif
|
|
|
|
}
|
2022-06-18 12:39:49 +00:00
|
|
|
} else {
|
|
|
|
content
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|