Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
26 lines
796 B
Swift
26 lines
796 B
Swift
// AvatarBorder — the round edge on avatars.
|
|
//
|
|
// Covers and other square images use RedWhiteUI's `.rwBorder(.accent,
|
|
// width: 2)` directly. A round image can't: rwBorder strokes a
|
|
// continuous-cornered RoundedRectangle, and at a huge corner radius that is a
|
|
// squircle, not a circle — it stuck out past a Circle-clipped avatar at all
|
|
// four sides. So avatars get a real Circle, 2pt, in the same primary.
|
|
|
|
import RedWhiteUI
|
|
import SwiftUI
|
|
|
|
extension View {
|
|
/// The 2pt primary edge, for a Circle-clipped image.
|
|
func avatarBorder() -> some View {
|
|
modifier(AvatarBorder())
|
|
}
|
|
}
|
|
|
|
private struct AvatarBorder: ViewModifier {
|
|
@Environment(\.rw) private var p
|
|
|
|
func body(content: Content) -> some View {
|
|
content.overlay(Circle().strokeBorder(p.red.color, lineWidth: 2))
|
|
}
|
|
}
|