Swift 4 中 [MoveCommand] 的替代品是什么

What could be the replacement for [MoveCommand] in Swift 4

我正在学习 iOS 开发,并且正在观看 YouTube 上的教程,该教程从 2014 年开始就很老了。

import UIKit

protocol GameModelProtocol: class {
    func scoreChange(score: Int)
    func moveOneTile(from: (Int, Int), to: (Int, Int), value: Int)
    func moveTwoTile(from: ((Int, Int), (Int, Int)), to: (Int, Int), value: Int)
    func insertTile(location: (Int, Int), value: Int)
}
[![enter image description here][1]][1]
class GameModel: NSObject {

let dim: Int
let limit: Int

var score: Int = 0 {
    didSet {
        delegate.scoreChange(score: score)
    }
}

var gameBoard: SquareGameBoard<TileObject>

let delegate: GameModelProtocol

var queue: [MoveCommand]

var timer: Timer

let maxCommands = 100
let queueDelay = 0.3

init(dim d: Int, limit l: Int, delegate: GameModelProtocol) {
    dim = d
    limit = l
    self.delegate = delegate
    queue = [MoveCommand]()
    timer = Timer()
    gameBoard = SquareGameBoard(dim: d, initialValue: .Empty)
    super.init()
}

指导老师说他是把它当作一个数组来使用的。但我无法弄清楚它是如何被使用的,或者我如何改变它以使用 Swift 4.

这是 YouTube 视频的link

我只想知道如何替换 [MoveCommand] 以在 Swift 中工作 4. 我已经修复了代码中的大部分问题,但我无法弄清楚这个问题。

MoveCommand 是在 AuxiliaryModels.swift 中定义的结构。您应该下载完整的项目示例代码:https://github.com/austinzheng/swift-2048
希望这有帮助。