title: NSMutableArray. Objective-c to swift code
body: <p>I'm trying to convert this Objective-C code to swift, but can't seem to figure it out:</p>
  
  <pre><code>@implementation MultiplayerNetworking {
      uint32_t _ourRandomNumber;
      GameState _gameState;
      BOOL _isPlayer1, _receivedAllRandomNumbers;
  
      NSMutableArray *_orderOfPlayers;
  
  
  
      #define playerIdKey @"PlayerId"
      #define randomNumberKey @"randomNumber"
  
      - (id)init
      {
          if (self = [super init]) {
              _ourRandomNumber = arc4random();
              _gameState = kGameStateWaitingForMatch;
              _orderOfPlayers = [NSMutableArray array];
              [_orderOfPlayers addObject:@{playerIdKey : [GKLocalPlayer localPlayer].playerID, randomNumberKey : @(_ourRandomNumber)}];
          }
          return self;
      }
  };  
  </code></pre>
  
  <p>This is what I thought I would be, but I'm no sure at all, so I would appreciate som help here.</p>
  
  <pre><code>class MultiplayerNetworking {
  
      var _ourRandomNumber = uint32_t()
      var _gameState = GameState()
      var isPlayer1 = false
      var receivedAllRandomNumbers = false
      var orderOfPlayers = [AnyObject]()
  
      let playerIdKey = "PlayerId"
      let randomNumberKey = "randomNumber"
  
      override init() {
          super.init()
  
          self.ourRandomNumber = arc4random()
          self.gameState = kGameStateWaitingForMatch
          self.orderOfPlayers = [AnyObject]()
          orderOfPlayers.append([playerIdKey: GKLocalPlayer.localPlayer().playerID, randomNumberKey: ourRandomNumber])
  
      }
  }
  </code></pre>
  
  <p>But it gives me some errors, a lot:</p>
  
  <p><a href="https://i.stack.imgur.com/a8w47.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a8w47.png" alt="Errors"></a></p>
  
  <p>I used this converter: <a href="https://objectivec2swift.com/#/home/converter/" rel="nofollow noreferrer">objectivec2swift.com</a> since I have no experience with Objective-C</p>