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
import SwiftUI
enum ImageBorderStyle {
static let width: CGFloat = 1.75
}
extension EnvironmentValues {
@Entry var showsTimelineImageBorders = false
}
struct ImageBorder<BorderShape: InsettableShape>: View {
@Environment(\.colorScheme) private var colorScheme
@Environment(\.showsTimelineImageBorders) private var showsBorder
let shape: BorderShape
let colors: AvatarRingColors
var body: some View {
if showsBorder {
let color = colorScheme == .dark ? colors.dark : colors.light
shape.strokeBorder(Color(uiColor: color.color), lineWidth: ImageBorderStyle.width)
.allowsHitTesting(false)
.accessibilityHidden(true)
}
}
}