// The box's "+" (architect 6 Oct 07:25Z): ONE act everywhere — attach a photo,// photos or a file to whatever the box sends from here. On the database page// onto the thought; on a list onto the thought said there; on a record's page// onto that record, through the thought said on it, which its page shows.// The menu is this one row, the same words on every box, just above it.// Scan a page may follow.importCottonKitimportSwiftUIenumBoxAttach {/// What the "+" says aloud.staticvar label: String { ShellLines.line("input", "attach.label") }/// The menu, in the ruling's order.staticvar choices: [AttachmentChoice] { (Camera.isAvailable ? [.camera] : []) + [.library, .file] }staticfunc label(_ choice: AttachmentChoice) -> String {switch choice {case .camera: returnShellLines.line("input", "attach.camera")case .library: returnShellLines.line("input", "attach.library")case .file: returnShellLines.line("input", "attach.file") } }/// The source state a menu choice opens.staticfuncopen(_ choice: AttachmentChoice) -> AttachmentSourceState {var sources = AttachmentSourceState()switch choice {case .library: sources.library = truecase .camera: sources.camera = Camera.isAvailablecase .file: sources.files = true }return sources }}/// The "+"'s menu, in the page's own hand, just above the box it adds to.structBoxAttachMenu: View {let onChoose: (AttachmentChoice) -> Voidvar body: someView { HStack(spacing: 18) {ForEach(BoxAttach.choices) { choice inPaperTypedButton(BoxAttach.label(choice), size: 14) { onChoose(choice) } .fixedSize() .accessibilityIdentifier("cap-add-\(choice.rawValue)") } } .frame(maxWidth: .infinity, alignment: .leading) .padding(.horizontal, 6) .accessibilityElement(children: .contain) .accessibilityLabel(BoxAttach.label) }}