#if COTTON_DEV// DevCorner.swift — DEVELOPER TOOL, compiled into Cotton Dev only.//// Every screen's corner says which build this is and which store schema it// writes, so a screenshot in a report needs no question about the build. With// Settings › Developer › Show timings on, it also says the surface on screen,// its time to first rows and the reads it made; a tap opens the list.importCottonKitimportSwiftUIstructDevCorner: View {/// A leaf reader (`Scaffold/CottonCoreKey.swift`): no core, no schema line. @Environment(\.cottonCore) privatevar core @State privatevar schema: Int? @State privatevar expanded = falseprivatelet timings = DevTimings.sharedprivatelet build = BuildFacts.fromBundle()privatestructFacts: Decodable { let schemaVersion: Int }var body: someView { VStack(alignment: .trailing, spacing: 2) {if timings.showing {// The reads are not observed; a second's tick redraws them.TimelineView(.periodic(from: .now, by: 1)) { _ in VStack(alignment: .trailing, spacing: 2) { timingLines } } }Text(stamp) } .font(.system(size: 9, weight: .medium, design: .monospaced)) .foregroundStyle(.white) .padding(.horizontal, 5) .padding(.vertical, 2) .background(.black.opacity(0.55), in: RoundedRectangle(cornerRadius: 4)) .padding(4) .onTapGesture { if timings.showing { expanded.toggle() } }// It sits over the page's foot: a tap meant for what is under it (the// tray's undo) passes through unless it has timings to open (walker,// 16 Oct 2026: undo under the corner did nothing). .allowsHitTesting(timings.showing) .accessibilityIdentifier("dev-corner") .task {guardlet core else { return } schema = (try? await core.call("build.facts", as: Facts.self))?.schemaVersion } }privatevar stamp: String {// The developer's corner, opened on purpose in a dev build, keeps the// schema the person-facing build line no longer writes.BuildLine.own(version: build.version, build: build.build, commit: build.commit) + " · schema \(schema.map(String.init) ?? "?")" } @ViewBuilder privatevar timingLines: someView {let reads = timings.reads()let first = timings.firstRowMillis.map { String(format: "%.0f ms", $0) } ?? ShellLines.line("developer", "corner.no_rows")Text(ShellLines.line("developer", "corner.timings", ["surface": timings.surface ?? ShellLines.line("developer", "corner.no_surface"),"first": first,"reads": String(reads.count), ]))if expanded {ForEach(Array(reads.suffix(20).enumerated()), id: \.offset) { _, call inText(String(format: "%@ %.0f ms", call.method, call.millis)) } } }}#endif