1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import SwiftUI
struct MediaControlSurface: ViewModifier {
@Environment(\.colorScheme) private var colorScheme
@Environment(\.colorSchemeContrast) private var contrast
@Environment(\.displayScale) private var displayScale
func body(content: Content) -> some View {
let shape = RoundedRectangle(cornerRadius: 12, style: .continuous)
content
.foregroundStyle(.primary)
.background(
Color(uiColor: colorScheme == .dark ? .secondarySystemGroupedBackground : .tertiarySystemFill),
in: shape
)
.overlay {
if colorScheme == .light {
shape.strokeBorder(
Color(uiColor: contrast == .increased ? .secondaryLabel : .separator),
lineWidth: contrast == .increased ? 2 : 1 / displayScale
)
.allowsHitTesting(false)
.accessibilityHidden(true)
}
}
.contentShape(shape)
}
}