Atelier Clockwork

Building Minesweeper 1

Shall we make a game?

One of my first things I built when learning SwiftUI was an implementation of Minesweeper. I've done a major refactor of the game every year as more SwiftUI features have been added, and I've learned more about working in SwiftUI.

I'm starting the process again this year, and as I complete the implementation I'll write blog posts covering any interesting points that I've learned.

My goal for features this year is:

  • Use the new Multiplatform app design and support iPad + Mac
  • Settings and high scores persisted via AppStorage
  • Minesweeper gameplay including
    • Revealing mines
    • Flagging mines
    • Revealing all of the mines if the user taps a numbered square

Out of the list, the one that is the most fiddly is flagging mines, because SwiftUI doesn't natively support two finger taps or right clicks. I've worked around that in the past by supporting option click, but I'll take another swing at improving it.

I have what I think is a good version of the data model for the game board itself set up, so I'll make an attempt to refine that as well but I don't need to build that from the ground up.