Skip to content

Instantly share code, notes, and snippets.

@pitt500
Last active March 17, 2021 13:06
Show Gist options
  • Save pitt500/13634029f657ab9b0de6cef41b55ebd2 to your computer and use it in GitHub Desktop.
Save pitt500/13634029f657ab9b0de6cef41b55ebd2 to your computer and use it in GitHub Desktop.
SoccerPlayer code requiered for video "Protocols in Swift Pt 2: Methods, initializers & extensions" https://youtu.be/qiMFIopQJME
protocol Player {
var name: String { get set }
var score: Int { get }
var nickname: String { get }
static var numberOfPlayers: Int { get set }
}
struct SoccerPlayer: Player {
var name: String
var score: Int
var nickname: String
static var numberOfPlayers: Int = 1
var jerseyNumber: Int
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment