in tutorials/tutorial3/TicTacToe/TicTacToe/TicTacToeViewController.swift [53:68]
func announce(winner: PlayerType) {
let winnerString: String = {
switch winner {
case .player1:
return "Red"
case .player2:
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)
}