func announce()

in tutorials/tutorial2/TicTacToe/TicTacToe/TicTacToeViewController.swift [61:76]


    func announce(winner: PlayerType) {
        let winnerString: String = {
            switch winner {
            case .red:
                return "Red"
            case .blue:
                return "Blue"
            }
        }()
        let alert = UIAlertController(title: "\(winnerString) Won!", message: nil, preferredStyle: .alert)
        let closeAction = UIAlertAction(title: "Close Game", style: UIAlertActionStyle.default) { [weak self] _ in
            self?.listener?.closeGame()
        }
        alert.addAction(closeAction)
        present(alert, animated: true, completion: nil)
    }