// A list's Select tick: the round mark in a picked record's corner, filled // when picked. Drawn once for any list that selects (`select`), the library's // prints and its contact sheet alike. import SwiftUI struct PickMark: View { @Environment(\.theme) private var theme let isPicked: Bool /// Ticked before the pick began (already in the group): the tick in /// pencil, not the accent, and not the pick's to take back. var isHeld = false let identifier: String? var body: some View { VStack { Spacer(minLength: 0) HStack { Spacer(minLength: 0) ZStack { Circle() .fill(isHeld ? theme.colors.inkSecondary.color : isPicked ? theme.colors.accent.color : theme.colors.groundMuted.color) .frame(width: PickMarkKnobs.facePickMarkSide, height: PickMarkKnobs.facePickMarkSide) if isPicked { Image(systemName: "checkmark") .font(theme.type.interface(PickMarkKnobs.facePickMarkTypeSize, weight: .semibold)) .foregroundStyle(theme.colors.accentContrast.color) } } .padding(PickMarkKnobs.facePickMarkPadding) } } .accessibilityHidden(true) .accessibilityIdentifier(identifier ?? "") } } extension View { /// A value read out after the element's label ("Already in Family"); /// nothing added when there are no words. @ViewBuilder func spokenValue(_ words: String?) -> some View { if let words { accessibilityValue(words) } else { self } } } /// The sizes, counts and timings PickMark draws with: Swift's own, beside /// their reader — a theme sets only its tokens (`scale.tokens`). enum PickMarkKnobs { static let facePickMarkPadding: CGFloat = 4 static let facePickMarkSide: CGFloat = 22 static let facePickMarkTypeSize: CGFloat = 14 }