Avoiding the inconvenient immutable model

I really like SwiftUI and its use of lightweight structs for Views but every time I start a new project (hobby programming exclusively) I come up against this Wall which is the requirement that my model should be a(n immutable) struct. I want my model to have mutable state.

I’d like to know if my (ingenious?) solution is flawed.

I’m using the MVVM approach. The model is an immutable struct, the ViewModel an ObservableObject (a class) and I have added a further element, a ModelState object (a class) which only has static members and functions and is never instantiated. This last element serves as the mutable part of my model struct. So a game might have the following elements:

    struct Model {
       var nPlayers: Int { get { ModelState.nPlayers } set { ModelState.nPlayers = newValue } }
       var turnNo: Int { get { ModelState.turnNo } set { ModelState.turnNo = newValue } }
       var deck: [[Card]] { get { ModelState.deck } set { ModelState.deck = newValue } }
       var suits: [Suit] { get { ModelState.suits } set { ModelState.suits = newValue } }
       var players: [Player] { get { ModelState.players } set { ModelState.players = newValue } }
       var nextPlayerIndex: Int { get { ModelState.nextPlayerIndex } }
       var player: Player { players[nextPlayerIndex] }
       init() {}

    class ModelState {
       static var nPlayers = 0
       static var turnNo = 1
       static var deck = [[Card]]()
       static var suits = [Suit]()
       static var players = [Player]()
       static var nextPlayerIndex: Int = 0 {
          didSet {
             if nextPlayerIndex == nPlayers {
                nextPlayerIndex = 0
             turnNo += 1

Now my struct is effectively mutable.

You can always flag a method that mutates your structure (mutating), this will create a copy of your original struct and replace the original, by the way, your object must be a var. You can prevent this by using a class. Class vs Struct has pros/cons and which one should be best used is depending on your needs.

struct MyStruct {
  var name: String
  mutating func change(to name: String) {
    self.name = name
var my = MyStruct(name: "Swifter")
my.change(to: "Swift")

Why all this hassle? Optimizations.