importCottonPaperimportSwiftUI/// A view's painted fan tile (Round 17, variation b, the owner's pick for Cotton/// Books, 5 Nov 2026): a cream card with one small painted object at its/// head, wordless, is the whole tile face, its alpha kept — the card's own/// worn edge and corners are the picture's. Beneath the object the view's/// name is typed centred in Courier Prime, its count under it, in the ink/// the plain card's words take. The picture is the view's (`ToolView.picture`,/// one of the core's `VIEW_PICTURES`), kept once at 3x of the 158 x 232 pt/// tile as `view-<picture>` (`scripts/import-books-materials.py views`). A/// view without one draws the plain cream card (`FanTierCard`).structViewTile: View {/// The tile's catalogue name (`asset`).let painted: Stringlet label: Stringlet count: Int?let width: Doublelet height: Double/// The phone's text size, as far as the words still fit the card's/// lower part (`FanTierWords`).var growth: CGFloat = 1 @Environment(\.theme) privatevar theme/// The catalogue name a view's picture is kept under. nonisolated staticfunc asset(_ picture: String) -> String { "view-\(picture)" }var body: someView { ZStack(alignment: .top) {iflet picture = CottonMedia.image(painted) { picture.resizable().interpolation(.high) } VStack(spacing: height * ViewTileKnobs.gap) {// Never cut: two lines, then smaller (`FanTierWords`).let size = FanTierWords.size(label, cardWidth: width, preferred: ViewTileKnobs.name * growth)Text(FanTierWords.broken(label, size: size, cardWidth: width)) .font(CottonFonts.type(size)) .multilineTextAlignment(.center) .lineLimit(FanTierWords.lines) .fixedSize(horizontal: false, vertical: true)iflet count {Text(String(count)) .font(CottonFonts.type(FanTierWords.size(String(count), cardWidth: width, preferred: ViewTileKnobs.count * growth, lines: 1))) .lineLimit(1) .fixedSize(horizontal: false, vertical: true) } } .foregroundStyle(theme.print(.ink)) .frame(width: width * FanGeometry.labelWidthRatio) .padding(.top, height * ViewTileKnobs.wordsTop) } .frame(width: width, height: height) .softShadow() }}/// Measured off Round 17's composite proof (`fan.png`): the object fills the/// card's upper half; the name starts a little past the middle, the count/// under it.enumViewTileKnobs {/// Where the name's first line starts, from the card's top.staticlet wordsTop = 0.55/// The space between the name and the count.staticlet gap = 0.05/// The name's and the count's type, against the card's width.staticlet name = 0.1staticlet count = 0.09}