// A CARD ON THE WHOLE SCREEN (door row 12). A pinch out on a card opens what// it holds (`DeckOpening`): a picture, a film or a document in the one// viewer, a note or a memory on its reading page (`ReadPage`), and every// other card as large as the screen allows, to read:// nothing on it edits, its own pages still turn with a swipe, and a pinch in// or the close X puts it back.importCottonKitimportCottonPaperimportSwiftUIenumDeckWholeCardKnobs {/// How far a pinch opens before the card goes whole, and closes before/// it goes back.staticlet opens: CGFloat = 1.15staticlet closes: CGFloat = 0.87staticlet inset: CGFloat = 16/// The X's row over the card.staticlet top: CGFloat = 56}extensionView {/// A pinch out on this card opens what it holds (`opening`), standing/// open while `opened` is true, so a tap opens it as the pinch does/// (`DeckOpening.open`): a note's page in the middle third.func pinchOpens(_ opening: DeckOpening, opened: Binding<Bool>) -> someView { modifier(PinchOpens(opening: opening, opened: opened)) }}extensionDeckOpening {/// Opens it: the viewer by its own act, the reading page by standing its/// cover up (`shown`); a card with neither opens nothing.funcopen(_ shown: Binding<Bool>) {switchself {case .viewer(let show): show()case .reading: shown.wrappedValue = truecase .whole: break } }/// Whether a pinch out opens anything.var opens: Bool {ifcase .whole = self { returnfalse }returntrue }}privatestructPinchOpens: ViewModifier {let opening: DeckOpeninglet opened: Binding<Bool>privatefuncopen() { opening.open(opened) }func body(content: Content) -> someView { content .simultaneousGesture(MagnifyGesture().onEnded { pinch inif pinch.magnification > DeckWholeCardKnobs.opens { open() } })// The pinch, for VoiceOver: one named action, where it opens something. .accessibilityActions {if opening.opens {Button(ShellLines.line("cards", "deck.whole")) { open() } } } .wholeScreen(isPresented: opened) {ifcase .reading(let document) = opening {ReadPage(document: document) { opened.wrappedValue = false } } } }}