crossmate

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

Square.swift (840B)


      1 import Foundation
      2 
      3 /// Per-cell state for one square in the grid. Combines the letter entry and
      4 /// mark (previously parallel arrays on `Game`) with sync bookkeeping fields.
      5 struct Square: Sendable {
      6     var entry: String = ""
      7     var mark: CellMark = .none
      8     var updatedAt: Date?
      9     var letterAuthorID: String?
     10     /// Non-nil while a local edit to this square is buffered in
     11     /// `MovesUpdater` but not yet flushed to `MovesEntity`. Carries the
     12     /// MainActor-stamped enqueue timestamp. `GameStore.restore` leaves the
     13     /// square's value fields untouched while this is set, so a remote-moves
     14     /// refresh that lands mid-debounce can't revert the letter the user just
     15     /// typed; the flag is cleared on the matching flush (timestamp-guarded so
     16     /// a newer same-cell edit stays protected).
     17     var enqueuedAt: Date?
     18 }