// A studio's TRAINER in its own look (Codex round 2: syz-trainer; the// coordinator's review of aa7f6389e): the photograph across the top to the// card's edge, the name heavy, the styles in teal (`subtitle`), a line of who// they are (`body`), and their next classes as coral chips under the core's// label for them (`facts`: each class's words, the first's label). A trainer// whose card names no photograph is drawn on their initials, as a client is// (`ClientFace`). No action is drawn on the card. Every word is the core's.importCottonPaperimportCottonValuesimportSwiftUI/// A trainer: the photograph across the top, the name, the styles, a line/// of who they are, the next classes as coral chips; with no photograph,/// the client's face on their initials.publicstructTrainerFace<Photo: View>: View {let card: DeckCardvar photo: Photo?/// The pages its card turns to after it (`card.pages`), each a column's/// words under its label (`FaceTurns`).var pages: [CardPage] = []publicinit(card: DeckCard, photo: Photo?, pages: [CardPage] = []) {self.card = cardself.photo = photoself.pages = pages }publicvar body: someView {if card.text("photo") == nil {ClientFace(card: card, pages: pages) } else {FaceTurns(pages: pages) { pictured } .onCardPaper(TrainerFaceCatalogue.stock.laid(card.pace)) } }privatevar pictured: someView {GeometryReader { sheet in VStack(alignment: .leading, spacing: 0) {iflet photo { photo .frame(width: sheet.size.width, height: sheet.size.height * StudioBrandKnobs.portraitShare) .clipped() .accessibilityIdentifier("face-photo") .facePart(.picture) }TrainerWords(card: card) .padding(StudioBrandKnobs.inset) .frame(width: sheet.size.width, alignment: .topLeading) } .frame(width: sheet.size.width, height: sheet.size.height, alignment: .topLeading) .clipped() } }}privatestructTrainerWords: View {let card: DeckCard @Environment(\.theme) privatevar themevar body: someView { VStack(alignment: .leading, spacing: 6) {iflet name = card.text("title") {Text(name) .font(theme.type.display(StudioBrandKnobs.nameSize)) .lineLimit(1) .minimumScaleFactor(0.6) .faceInk(.ink) .accessibilityIdentifier("deck-title") .facePart(.title) }iflet line = card.text("subtitle") {Text(line) .font(theme.type.title(StudioBrandKnobs.lineSize)) .lineLimit(1) .minimumScaleFactor(0.75) .foregroundStyle(theme.colors.ink.color) .facePart(.subtitle) }iflet about = card.text("body") {Text(about) .font(theme.type.body(StudioBrandKnobs.aboutSize)) .lineLimit(2) .foregroundStyle(theme.colors.inkBody.color.opacity(StudioFaceKnobs.labelFaint)) .facePart(.body) }TrainerClasses(card: card).padding(.top, 6) } }}/// The next classes: the core's label for them by a calendar, each class's/// words on a coral chip.privatestructTrainerClasses: View {let card: DeckCard @Environment(\.theme) privatevar themevar body: someView {let facts = StudioReading.facts(card)if !facts.isEmpty { HStack(spacing: 8) {Image(systemName: "calendar") .font(theme.type.body(StudioBrandKnobs.chipSize + 3)) .foregroundStyle(theme.colors.accent.color) .accessibilityHidden(true)iflet label = facts.first?.label {Text(label) .font(theme.type.body(StudioBrandKnobs.chipSize)) .lineLimit(1) .fixedSize() .foregroundStyle(theme.colors.inkBody.color) }ForEach(Array(facts.prefix(2).enumerated()), id: \.offset) { _, fact inText(fact.said) .font(theme.type.title(StudioBrandKnobs.chipSize)) .lineLimit(1) .minimumScaleFactor(0.7) .foregroundStyle(theme.colors.accent.color) .padding(StudioBrandKnobs.chipPad) .background(Capsule().fill(theme.colors.accent.color.opacity(StudioBrandKnobs.chipFaint))) } } .accessibilityElement(children: .combine) .accessibilityIdentifier("face-classes") } }}/// The trainer face, and the cards it is reviewed in. A studio's kit names/// it for its trainers (`sharmila.trainer`), with the pages its card turns/// to.publicenumTrainerFaceCatalogue {publicstaticlet stock: FaceStock = .creampublicstaticlet ground: FaceGround = .paperpublicstaticlet face = Face(id: "sharmila.trainer", specimens: [Specimen("trainer", trainer)]) { card, picture, _ inTrainerFace(card: card, photo: picture, pages: card.pages) }publicstaticlet trainer = DeckCard(face: .sharmilaTrainer, fields: ["photo": .text("k"), "title": .text("Invented Trainer"), "subtitle": .text("Yoga Instructor"),"body": .text("An invented line."),"facts": .list([ .object(["label": .text("Invented label"), "said": .text("Mon 9:15 AM")]), .object(["label": .text("Invented label"), "said": .text("Wed 11:30 AM")]), ]), ])}