// The nav circle.//// Every nav control is a CIRCLE. Its fill is the cream PAPER the objects are// cut from, and the affordance is the soft shadow under it — every picture of// the redesign draws the back, the kebab and the plus this way, a paper disc// floating over the plaster. It was the white page ground, which read as a// white button laid on a cream page. The glyph is the paper's own ink, not the// chrome's grey.//// A sheet's close is the same circle wearing an X, top-right.importSwiftUIpublicstructNavCircle: View {privatelet symbol: Stringprivatelet label: Stringprivatelet action: () -> Voidprivatelet isDisabled: Bool @Environment(\.theme) privatevar themepublicinit( symbol: String, label: String, disabled: Bool = false, action: @escaping () -> Void ) {self.symbol = symbolself.label = labelself.isDisabled = disabledself.action = action }publicvar body: someView {Button(action: action) {NavDisc(symbol: symbol).opacity(isDisabled ? DisabledOpacity.control : 1) } .buttonStyle(MotionButtonStyle()) .disabled(isDisabled) .accessibilityLabel(label) }}/// The nav circle's face without its button: what a control that is not a/// `Button` (a `ShareLink`, a `Menu`) wears to read as a nav circle.publicstructNavDisc: View {let symbol: Stringpublicinit(symbol: String) { self.symbol = symbol }publicvar body: someView { ZStack {Circle() .fill(NavChrome.circleFill) .frame(width: NavCircleKnobs.chromeNavCircleDiameter, height: NavCircleKnobs.chromeNavCircleDiameter) .softShadow()Image(systemName: symbol) .font(.system(size: NavCircleKnobs.chromeNavGlyphSize, weight: .regular)) .foregroundStyle(NavChrome.glyphInk) }// The 39pt circle inside a 44pt target: the disc is what you see,// the target is what you hit. .frame(width: ScreenBarKnobs.chromeNavCircleTarget, height: ScreenBarKnobs.chromeNavCircleTarget) .contentShape(Rectangle()) }}enumNavChrome {/// The disc a nav control is drawn on: the cream paper's own paint.publicstaticvar circleFill: Color { PaperDye.cream.fill }/// The glyph on the disc — the ink the paper is printed in.publicstaticvar glyphInk: Color { CottonColors.ink }}/// The sizes, counts and timings NavCircle draws with: Swift's own, beside/// their reader — a theme sets only its tokens (`scale.tokens`).enumNavCircleKnobs {staticlet chromeNavCircleDiameter: CGFloat = 39/// The glyph on the disc.staticlet chromeNavGlyphSize: CGFloat = 18}