crossmate

A collaborative crossword app for iOS
Log | Files | Refs | LICENSE

commit 7e9c7909a6af77de116e50b193d06d618a80ba35
parent 07c2c972671cc7ff5e519bfddd9fc5305683683e
Author: Michael Camilleri <[email protected]>
Date:   Sat,  2 May 2026 09:42:44 +0900

Make grid squares equatable

This commit continues optimisation work to improve the responsiveness of
puzzle input.

Co-Authored-By: Codex GPT 5.5 <[email protected]>

Diffstat:
MCrossmate/Views/CellView.swift | 21+++++++++++++++------
MCrossmate/Views/GridView.swift | 2+-
2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/Crossmate/Views/CellView.swift b/Crossmate/Views/CellView.swift @@ -1,6 +1,6 @@ import SwiftUI -struct CellView: View { +struct CellView: View, Equatable { let cell: Puzzle.Cell let entry: String let mark: CellMark @@ -10,17 +10,29 @@ struct CellView: View { let specialKind: Puzzle.Special? var remoteWordTint: Color? = nil var remoteOutline: Color? = nil - var diagnosticProbeID: Int? var diagnosticPosition: GridPosition? @Environment(PlayerPreferences.self) private var preferences @Environment(PerformanceMonitor.self) private var performanceMonitor private var playerColor: PlayerColor { preferences.color } + nonisolated static func == (lhs: CellView, rhs: CellView) -> Bool { + lhs.cell == rhs.cell + && lhs.entry == rhs.entry + && lhs.mark == rhs.mark + && lhs.isSelected == rhs.isSelected + && lhs.isHighlighted == rhs.isHighlighted + && lhs.isRelatedToFocus == rhs.isRelatedToFocus + && lhs.specialKind == rhs.specialKind + && lhs.remoteWordTint == rhs.remoteWordTint + && lhs.remoteOutline == rhs.remoteOutline + && lhs.diagnosticPosition == rhs.diagnosticPosition + } + var body: some View { let _ = performanceMonitor.markViewBodyDeferred( "cell", - key: diagnosticProbeID.map { "probe=\($0)" } ?? "idle", + key: "active", detail: diagnosticDetail() ) ZStack(alignment: .topLeading) { @@ -63,9 +75,6 @@ struct CellView: View { private func diagnosticDetail() -> String { var parts: [String] = [] - if let diagnosticProbeID { - parts.append("probe=\(diagnosticProbeID)") - } if let diagnosticPosition { parts.append("lastRow=\(diagnosticPosition.row)") parts.append("lastCol=\(diagnosticPosition.col)") diff --git a/Crossmate/Views/GridView.swift b/Crossmate/Views/GridView.swift @@ -66,9 +66,9 @@ struct GridView: View { specialKind: session.puzzle.specialKind, remoteWordTint: tintByCell[pos], remoteOutline: outlineByCell[pos], - diagnosticProbeID: session.renderProbeID, diagnosticPosition: pos ) + .equatable() .onTapGesture { session.select(row: r, col: c) }